Commit 1a25956d authored by norvell's avatar norvell
Browse files

Merge with main and clang format

parents 58d51eff 944c7622
Loading
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ workflow:
    - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Pushes to main
    - if: $CI_PIPELINE_SOURCE == 'schedule' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Scheduled in main
    - if: $CI_PIPELINE_SOURCE == 'web' # for testing
    - if: $CI_PIPELINE_SOURCE == 'trigger'

stages:
  - .pre
@@ -135,6 +136,8 @@ stages:
      when: never
    - if: $CI_PIPELINE_SOURCE == 'schedule' # Don't run in any scheduled pipelines by default (use schedule templates below to enable again for certain conditions)
      when: never
    - if: $CI_PIPELINE_SOURCE == 'trigger'  # Don't run triggered pipeline by default
      when: never
    - when: on_success

.rules-merge-request:
@@ -1310,6 +1313,24 @@ complexity-StereoDmxEVS-stereo-in-mono-out:
# Other jobs
# ---------------------------------------------------------------

upload-selection-BE-log:
  rules:
  - if: $UPLOAD_SELECTION_BE_RESULTS && $CI_PIPELINE_SOURCE == 'trigger'
    when: always
  timeout: 5 minutes
  tags:
    - ericsson-windows-runner
  script:
    - cp -r $SELECTION_BE_RESULT ./selection-BE-result
    - Get-Content -Path selection-BE-result/public_log--sha-*.txt
    - $has_failed = (Select-String -Path selection-BE-result/public_log--sha-*.txt -Pattern '^FAILED tests' -CaseSensitive).Line
    - If($has_failed) {exit -1}
  artifacts:
    paths:
      - selection-BE-result/public_log--sha-*.txt
    when: always
    expire_in: 1 week

# job that sets up gitlab pages website
pages:
  stage: deploy
+146 −0
Original line number Diff line number Diff line
@@ -169,6 +169,131 @@ Word16 rate2EVSmode(
 * Re-allocate the list of indices
 *-------------------------------------------------------------------*/

#ifdef FIX_MEM_REALLOC_IND_LIST
ivas_error ind_list_realloc(
    INDICE_HANDLE old_ind_list,    /* i  : pointer to the beginning of the old buffer of indices */
    const int16_t max_num_indices, /* i  : new maximum number of allowed indices in the list */
    Encoder_Struct *st_ivas        /* i  : IVAS encoder structure                  */
)
{
    int16_t i, n, ch, n_channels, ind_list_pos, is_metadata, ivas_max_num_indices;
    INDICE_HANDLE new_ind_list;
    BSTR_ENC_HANDLE hBstr;

    if ( st_ivas == NULL )
    {
        return IVAS_ERR_OK;
    }

    /* get the pointer to the beginning of the old buffer of indices (either metadata or core coders) */
    if ( old_ind_list == st_ivas->ind_list_metadata )
    {
        is_metadata = 1;
        ivas_max_num_indices = st_ivas->ivas_max_num_indices_metadata;
    }
    else
    {
        is_metadata = 0;
        ivas_max_num_indices = st_ivas->ivas_max_num_indices;
    }

    /* allocate new buffer of indices */
    if ( ( new_ind_list = (INDICE_HANDLE) malloc( max_num_indices * sizeof( Indice ) ) ) == NULL )
    {
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for buffer of indices!\n" ) );
    }

    /* move indices from the old list to the new list */
    for ( i = 0; i < min( max_num_indices, ivas_max_num_indices ); i++ )
    {
        if ( old_ind_list[i].nb_bits > -1 )
        {
            new_ind_list[i].id = old_ind_list[i].id;
            new_ind_list[i].value = old_ind_list[i].value;
        }
        new_ind_list[i].nb_bits = old_ind_list[i].nb_bits;
    }

    /* reset nb_bits of all other indices to -1 */
    for ( ; i < max_num_indices; i++ )
    {
        new_ind_list[i].nb_bits = -1;
    }

    /* update parameters in all SCE elements */
    for ( n = 0; n < st_ivas->nSCE; n++ )
    {
        /* get the pointer to hBstr */
        if ( is_metadata )
        {
            hBstr = st_ivas->hSCE[n]->hMetaData;
        }
        else
        {
            hBstr = st_ivas->hSCE[n]->hCoreCoder[0]->hBstr;
        }

        if ( hBstr != NULL )
        {
            /* get the current position inside the old list */
            ind_list_pos = (int16_t) ( hBstr->ind_list - old_ind_list );

            /* set pointers in the new list */
            *( hBstr->ivas_ind_list_zero ) = new_ind_list;
            hBstr->ind_list = &new_ind_list[ind_list_pos];

            /* set the new maximum number of indices */
            *( hBstr->ivas_max_num_indices ) = max_num_indices;
        }
    }

    /* update parameters in all CPE elements */
    for ( n = 0; n < st_ivas->nCPE; n++ )
    {
        /* get the pointer to hBstr */
        if ( is_metadata )
        {
            n_channels = 1;
        }
        else
        {
            n_channels = CPE_CHANNELS;
        }

        for ( ch = 0; ch < n_channels; ch++ )
        {
            if ( is_metadata )
            {
                hBstr = st_ivas->hCPE[n]->hMetaData;
            }
            else
            {
                hBstr = st_ivas->hCPE[n]->hCoreCoder[ch]->hBstr;
            }

            if ( hBstr != NULL )
            {
                /* get the current position inside the old list */
                ind_list_pos = (int16_t) ( hBstr->ind_list - old_ind_list );

                /* set pointers in the new list */
                *( hBstr->ivas_ind_list_zero ) = new_ind_list;
                hBstr->ind_list = &new_ind_list[ind_list_pos];

                /* set the new maximum number of indices */
                *( hBstr->ivas_max_num_indices ) = max_num_indices;
            }
        }
    }

    /* free the old list */
    free( old_ind_list );

    return IVAS_ERR_OK;
}

#else

ivas_error ind_list_realloc(
    BSTR_ENC_HANDLE hBstr,        /* i/o: encoder bitstream handle                          */
    const int16_t max_num_indices /* i  : new maximum number of allowed indices in the list */
@@ -216,6 +341,8 @@ ivas_error ind_list_realloc(
    return IVAS_ERR_OK;
}

#endif


/*-----------------------------------------------------------------------*
 * get_ivas_max_num_indices()
@@ -468,6 +595,7 @@ int16_t get_core_max_num_indices(
    const int32_t total_brate /* i  : total bitrate             */
)
{

    /* set the maximum number of indices in the core coder */
    if ( core == ACELP_CORE || core == AMR_WB_CORE )
    {
@@ -862,11 +990,20 @@ ivas_error check_ind_list_limits(
    if ( ( &hBstr->ind_list[hBstr->nb_ind_tot] - ivas_ind_list_zero ) >= *( hBstr->ivas_max_num_indices ) )
    {
#ifdef DEBUGGING
#ifdef DEBUG_IND_LIST_MEMORY
        /* TODO: replace with the warning message below before the finalization of the IVAS codec */
        assert( 0 && "The maximum number of indices has been exceeded! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata()." );
#else
        fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame );
#endif
#endif

        /* reallocate the buffer of indices with increased limit */
#ifdef FIX_MEM_REALLOC_IND_LIST
        if ( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES, hBstr->st_ivas ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
@@ -890,11 +1027,20 @@ ivas_error check_ind_list_limits(
            if ( hBstr->ind_list >= ivas_ind_list_last )
            {
#ifdef DEBUGGING
#ifdef DEBUG_IND_LIST_MEMORY
                /* TODO: replace with the warning message below before the finalization of the IVAS codec */
                assert( 0 && "The maximum number of indices has been exceeded! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata()." );
#else
                fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame );
#endif
#endif

                /* no available empty slot -> need to re-allocate the buffer */
#ifdef FIX_MEM_REALLOC_IND_LIST
                if ( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES, hBstr->st_ivas ) ) != IVAS_ERR_OK )
#else
                if ( ( error = ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }
+2 −0
Original line number Diff line number Diff line
@@ -2237,11 +2237,13 @@ enum
    VOIP_RTPDUMP
};

#ifndef JBM_PARAMUPMIX
typedef enum _COV_SMOOTHING_TYPE
{
    COV_SMOOTH_SPAR,
    COV_SMOOTH_MC
} COV_SMOOTHING_TYPE;
#endif

/* clang-format on */
#endif /* CNST_H */
+20 −0
Original line number Diff line number Diff line
@@ -174,6 +174,9 @@ typedef enum
#define CPE_CHANNELS                            2                           /* number of CPE (stereo) channels */
#define FOA_CHANNELS                            4                           /* number of FOA channels */
#define HOA2_CHANNELS                           9
#ifdef UPDATE_FASTCONV_SBA_FILTER
#define HOA3_CHANNELS                           16
#endif

#define MAX_NUM_OBJECTS                         4                           /* max. number of audio objects */

@@ -1332,6 +1335,14 @@ typedef enum
#define MC_PARAMUPMIX_NCH                  2           /* number of channels to combine into 1 */
#define MC_PARAMUPMIX_MIN_CLDFB            8

#ifdef JBM_PARAMUPMIX
typedef enum _COV_SMOOTHING_TYPE
{
    COV_SMOOTH_SPAR,
    COV_SMOOTH_MC
} COV_SMOOTHING_TYPE;
#endif

typedef struct {
    const int32_t *value;
    const uint16_t *length;
@@ -1501,10 +1512,19 @@ typedef enum
#define BINAURAL_MAXBANDS                       60                          /* Max number of bands */
#define BINAURAL_CONVBANDS                      50                          /* Bands upto which convolution is performed */
#define BINAURAL_NTAPS                           5

#ifdef UPDATE_FASTCONV_SBA_FILTER
#define BINAURAL_NTAPS_SBA                       3
#endif

#define BINAURAL_NTAPS_MAX                      96

#define HRTF_SH_ORDER                           3
#ifdef UPDATE_FASTCONV_SBA_FILTER
#define HRTF_SH_CHANNELS                        HOA3_CHANNELS
#else
#define HRTF_SH_CHANNELS                        16
#endif
#define HRTF_LS_CHANNELS                        15
#define HRTF_NUM_BINS                           60
#define REVERB_PREDELAY_MAX                     20                          /* Max input delay for reverb module */
+37 −2
Original line number Diff line number Diff line
@@ -837,6 +837,10 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode(
/*! r: render granularity */
int16_t ivas_jbm_dec_get_render_granularity(
    const RENDERER_TYPE rendererType,                           /* i  : renderer type                                               */
#ifdef JBM_PARAMUPMIX
    const IVAS_FORMAT ivas_format,                              /* i  : ivas format                                                 */
    const MC_MODE mc_mode,                                      /* i  : MC mode                                                     */
#endif
   const int32_t output_Fs                                     /* i  : sampling rate                                               */
);

@@ -3877,6 +3881,23 @@ void ivas_mc_paramupmix_dec_read_BS(
    int16_t *nb_bits                                            /* o  : number of bits written                          */
);

#ifdef JBM_PARAMUPMIX
void ivas_mc_paramupmix_dec_digest_tc(
    Decoder_Struct *st_ivas,                                        /* i/o: IVAS decoder handle                            */
    const uint8_t nCldfbSlots,                                      /* i : number of CLFBS slots in the transport channels */
    const int16_t nSamplesForRendering                              /* i  : number of samples provided   */
);

void ivas_mc_paramupmix_dec_render(
    Decoder_Struct *st_ivas,                                        /* i/o: IVAS decoder handle                       */
    const uint16_t nSamplesAsked,                                   /* i  : number of CLDFB slots requested           */
    uint16_t *nSamplesRendered,                                     /* o  : number of CLDFB slots rendered            */
    uint16_t *nSamplesAvailable,                                    /* o  : number of CLDFB slots still to render     */
    float *input_f[],                                               /* i: core-coder transport channels  */
    float *output_f[]                                               /* i/o: synthesized core-coder transport channels */
);
#endif

void ivas_param_mc_metadata_open(
    const MC_LS_SETUP mc_ls_setup,                              /* i  : MC ls setup                                         */
    const int16_t lfe_index,                                    /* i  : channel index of LFE                                */
@@ -5144,6 +5165,19 @@ void ivas_binRenderer_close(
    BINAURAL_RENDERER_HANDLE *hBinRenderer                      /* i/o: decoder binaural renderer handle                */
);

#ifdef JBM_PARAMUPMIX
void ivas_binaural_cldfb(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                  */
    float *output_f[]                                           /* i/o: synthesized core-coder transport channels/DirAC output  */
);

void ivas_binaural_cldfb_sf(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                  */
    const int16_t n_samples_to_render,                          /* i  : output frame length per channel                         */
    const int16_t slot_size,                                    /* i  : JBM slot size                                           */
    float *output_f[]                                           /* i/o: synthesized core-coder transport channels/DirAC output  */
);
#else
#ifdef DEBUGGING
void ivas_binaural_cldfb(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                  */
@@ -5156,8 +5190,9 @@ void ivas_binaural_cldfb_sf(
    float *output_f[]                                           /* i/o: synthesized core-coder transport channels/DirAC output  */

);

#endif
#endif

void ivas_binRenderer(
    BINAURAL_RENDERER_HANDLE hBinRenderer,                      /* i/o: fastconv binaural renderer handle                       */
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData,       /* i  : combined head and external orientation handle           */
Loading