Commit 01c1860e authored by vaclav's avatar vaclav
Browse files

Merge branch '20230309_editorial_improvements' into 'main'

20230309 editorial improvements

See merge request !491
parents 23e284e4 c6eb42b1
Loading
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -706,8 +706,7 @@ ivas_error openCldfb(
    HANDLE_CLDFB_FILTER_BANK hs;
    int16_t buf_len;

    hs = (HANDLE_CLDFB_FILTER_BANK) malloc( sizeof( CLDFB_FILTER_BANK ) );
    if ( hs == NULL )
    if ( ( hs = (HANDLE_CLDFB_FILTER_BANK) malloc( sizeof( CLDFB_FILTER_BANK ) ) ) == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" );
    }
@@ -728,8 +727,7 @@ ivas_error openCldfb(
        buf_len = hs->p_filter_length;
    }

    hs->cldfb_state = (float *) malloc( buf_len * sizeof( float ) );
    if ( hs->cldfb_state == NULL )
    if ( ( hs->cldfb_state = (float *) malloc( buf_len * sizeof( float ) ) ) == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" );
    }
@@ -1148,8 +1146,7 @@ ivas_error cldfb_save_memory(
        hs->memory_length = hs->p_filter_length;
    }

    hs->memory = (float *) malloc( hs->memory_length * sizeof( float ) );
    if ( hs->memory == NULL )
    if ( ( hs->memory = (float *) malloc( hs->memory_length * sizeof( float ) ) ) == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n" );
    }
+1 −3
Original line number Diff line number Diff line
@@ -68,9 +68,7 @@ ivas_error createFdCngCom(
    HANDLE_FD_CNG_COM hs;

    /* Allocate memory */
    hs = (HANDLE_FD_CNG_COM) malloc( sizeof( FD_CNG_COM ) );

    if ( hs == NULL )
    if ( ( hs = (HANDLE_FD_CNG_COM) malloc( sizeof( FD_CNG_COM ) ) ) == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FD CNG COM" );
    }
+55 −23
Original line number Diff line number Diff line
@@ -785,19 +785,19 @@ float ism_dequant_meta(
    const int16_t cbsize                                        /* i  : codebook size                               */
);

ivas_error set_ism_metadata(
    ISM_METADATA_HANDLE hIsmMeta,                               /* i/o: ISM metadata handle */
    float azimuth,                                              /* i  : azimuth */
    float elevation                                            /* i  : elevation */
ivas_error ivas_set_ism_metadata(
    ISM_METADATA_HANDLE hIsmMeta,                               /* o  : ISM metadata handle                         */
    const float azimuth,                                        /* i  : azimuth value                               */
    const float elevation                                       /* i  : elevation value                             */
);

ivas_error create_ism_metadata_enc(
ivas_error ivas_ism_metadata_enc_create(
    Encoder_Struct *st_ivas,                                    /* i/o: IVAS encoder structure                      */
    const int16_t n_ISms,                                       /* i  : number of objects                           */
    int32_t element_brate_tmp[]                                 /* o  : element bitrate per object                  */
);

ivas_error create_ism_metadata_dec(
ivas_error ivas_ism_metadata_dec_create(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                      */
    const int16_t n_ISms,                                       /* i  : number of objects                           */
    int32_t element_brate_tmp[]                                 /* o  : element bitrate per object                  */
@@ -3114,6 +3114,7 @@ void ivas_dirac_param_est_enc(
    const SBA_MODE sba_mode                                    
 );


/*----------------------------------------------------------------------------------*
 * SBA format prototypes
 *----------------------------------------------------------------------------------*/
@@ -3150,6 +3151,7 @@ ivas_error ivas_cldfb_dec_reconfig(
    int16_t numCldfbAnalyses_old,                               /* i  : number of CLDFB analysis instances in previous frame  */
    const int16_t numCldfbSyntheses_old                         /* i  : number of CLDFB synthesis instances in previous frame */
);

/*! r: Ambisonic (SBA) order */
int16_t ivas_sba_get_order(
    const int16_t nb_channels,                                  /* i  : Number of ambisonic channels            */
@@ -3344,7 +3346,7 @@ void computeDiffuseness(
    float *diffuseness 
);

void ivas_dirac_dec_onset_detection_open(
ivas_error ivas_dirac_dec_onset_detection_open(
    const int16_t num_channels,
    const int16_t num_freq_bands,
    const int16_t max_band_decorr,
@@ -3360,7 +3362,7 @@ void ivas_dirac_dec_onset_detection_process(
    DIRAC_ONSET_DETECTION_STATE h_dirac_onset_detection_state 
);

void ivas_dirac_dec_decorr_open(
ivas_error ivas_dirac_dec_decorr_open(
    DIRAC_DECORR_PARAMS **ph_freq_domain_decorr_ap_params,
    DIRAC_DECORR_STATE **ph_freq_domain_decorr_ap_state,
    const int16_t num_freq_bands,
@@ -3393,7 +3395,7 @@ void ivas_dirac_dec_decorr_close(
);


void ivas_dirac_dec_output_synthesis_open(
ivas_error  ivas_dirac_dec_output_synthesis_open(
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: DirAC handle                                */
    const RENDERER_TYPE renderer_type,                          /* i  : renderer type                               */
    const int16_t nchan_transport,                              /* i  : number of transport channels                */
@@ -3670,7 +3672,7 @@ int16_t svd(
    const int16_t nChannelsC                                    /* i  : number of columns in the matrix to be decomposed */
);

void ivas_dirac_dec_output_synthesis_cov_open(
ivas_error ivas_dirac_dec_output_synthesis_cov_open(
    DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params,   /* i/o: handle for the covariance synthesis parameters                                                        */
    DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: handle for the covariance synthesis state                                                             */
    const int16_t max_band_decorr,                                    /* i  : uppermost frequency band where decorrelation is applied                                               */
@@ -3933,11 +3935,41 @@ void ivas_spar_bitrate_dist(
    const int16_t bwidth                                        /* i  : audio bandwidth                         */
);

void ivas_mdct( const float *pIn, float *pOut, const int16_t length );
void ivas_dct_windowing( const int16_t fade_len, const int16_t full_len, const int16_t dct_len, const int16_t zero_pad_len, const float *pWindow_coeffs, const int16_t frame_len, float *pOut_buf, float *pBuffer_prev, float *pTemp_lfe );
void ivas_tda( const float *pIn, float *pOut, const int16_t length );
void ivas_imdct( const float *pIn, float *pOut, const int16_t length );
void ivas_itda( const float *re, float *pOut, const int16_t length );
void ivas_mdct( 
    const float *pIn, 
    float *pOut, 
    const int16_t length 
);

void ivas_dct_windowing( 
    const int16_t fade_len, 
    const int16_t full_len, 
    const int16_t dct_len, 
    const int16_t zero_pad_len, 
    const float *pWindow_coeffs, 
    const int16_t frame_len, 
    float *pOut_buf, 
    float *pBuffer_prev, 
    float *pTemp_lfe 
);

void ivas_tda( 
    const float *pIn, 
    float *pOut, 
    const int16_t length 
);

void ivas_imdct( 
    const float *pIn, 
    float *pOut, 
    const int16_t length 
);

void ivas_itda( 
    const float *re, 
    float *pOut, 
    const int16_t length 
);

void ivas_spar_get_cldfb_gains(
    SPAR_DEC_HANDLE hSpar,
@@ -4452,7 +4484,7 @@ ivas_error ivas_masa_dec_reconfigure(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                          */
);

void ivas_masa_encode(
ivas_error ivas_masa_encode(
    MASA_ENCODER_HANDLE hMasa,                                  /* i/o: MASA encoder structure                          */
    IVAS_QMETADATA_HANDLE hQMetaData,                           /* i/o: q_metadata handle                               */
    BSTR_ENC_HANDLE hMetaData,                                  /* i/o: Metadata bitstream handle                       */
@@ -4915,7 +4947,7 @@ ivas_error ivas_td_binaural_open(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);

void ivas_td_binaural_renderer(
ivas_error ivas_td_binaural_renderer(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float output[][L_FRAME48k],                                 /* i/o: SCE channels / Binaural synthesis       */
    const int16_t output_frame                                  /* i  : output frame length                     */
+38 −44
Original line number Diff line number Diff line
@@ -98,9 +98,8 @@ ivas_error ivas_qmetadata_allocate_memory(
    const int16_t coherence_flag      /* i  : new coherence coding status   */
)
{
    int16_t dir;
    int16_t j, dir;
    uint8_t do_realloc;
    uint8_t reservationFailed = 0;

#ifdef DEBUGGING
    assert( hQMetaData != NULL );
@@ -126,11 +125,12 @@ ivas_error ivas_qmetadata_allocate_memory(
        hQMetaData->no_directions = ndirs;
        hQMetaData->coherence_flag = coherence_flag;

        hQMetaData->q_direction = (IVAS_QDIRECTION *) malloc( sizeof( IVAS_QDIRECTION ) * ndirs );
        reservationFailed = hQMetaData->q_direction == NULL;

        if ( !reservationFailed )
        if ( ( hQMetaData->q_direction = (IVAS_QDIRECTION *) malloc( sizeof( IVAS_QDIRECTION ) * ndirs ) ) == NULL )
        {
            return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for Q MetaData" );
        }


        for ( dir = 0; dir < hQMetaData->no_directions; dir++ )
        {
            hQMetaData->q_direction[dir].cfg.nbands = nbands;
@@ -140,9 +140,11 @@ ivas_error ivas_qmetadata_allocate_memory(
            }
            else
            {
                    hQMetaData->q_direction[dir].band_data = (IVAS_QDIRECTION_BAND_DATA *) malloc( sizeof( IVAS_QDIRECTION_BAND_DATA ) * hQMetaData->q_direction[dir].cfg.nbands );
                if ( ( hQMetaData->q_direction[dir].band_data = (IVAS_QDIRECTION_BAND_DATA *) malloc( sizeof( IVAS_QDIRECTION_BAND_DATA ) * hQMetaData->q_direction[dir].cfg.nbands ) ) == NULL )
                {
                        int16_t j;
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for Q MetaData" );
                }

                for ( j = 0; j < nbands; j++ )
                {
                    set_zero( hQMetaData->q_direction[dir].band_data[j].elevation, MAX_PARAM_SPATIAL_SUBFRAMES );
@@ -150,14 +152,9 @@ ivas_error ivas_qmetadata_allocate_memory(
                }
            }


                    reservationFailed |= hQMetaData->q_direction[dir].band_data == NULL;
                }

            if ( coherence_flag )
            {
                hQMetaData->q_direction[dir].coherence_band_data = (IVAS_QDIRECTION_BAND_COHERENCE_DATA *) malloc( sizeof( IVAS_QDIRECTION_BAND_COHERENCE_DATA ) * hQMetaData->q_direction[dir].cfg.nbands );
                    reservationFailed |= hQMetaData->q_direction[dir].coherence_band_data == NULL;
            }
            else
            {
@@ -173,20 +170,17 @@ ivas_error ivas_qmetadata_allocate_memory(

        if ( coherence_flag )
        {
                hQMetaData->surcoh_band_data = (IVAS_SURROUND_COHERENCE_BAND_DATA *) malloc( sizeof( IVAS_SURROUND_COHERENCE_BAND_DATA ) * hQMetaData->q_direction[0].cfg.nbands );
                reservationFailed |= hQMetaData->surcoh_band_data == NULL;
            if ( ( hQMetaData->surcoh_band_data = (IVAS_SURROUND_COHERENCE_BAND_DATA *) malloc( sizeof( IVAS_SURROUND_COHERENCE_BAND_DATA ) * hQMetaData->q_direction[0].cfg.nbands ) ) == NULL )
            {
                return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for Q MetaData" );
            }
        }
        else
        {
            hQMetaData->surcoh_band_data = NULL;
        }
    }
    }

    if ( reservationFailed )
    {
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Q MetaData\n" ) );
    }

    return IVAS_ERR_OK;
}
+40 −44
Original line number Diff line number Diff line
@@ -8663,17 +8663,13 @@ void ApplyFdCng(
    const int16_t concealWholeFrame, /* i  : binary flag indicating frame loss       */
    const int16_t is_music );

void perform_noise_estimation_dec(
    const float *timeDomainInput,
    float *power_spectrum,
    HANDLE_FD_CNG_DEC hFdCngDec,   /* i/o: FD_CNG structure                                 */
    const int16_t element_mode,    /* i  : element mode type                                */
    const int16_t bwidth,          /* i  : audio bandwidth                                  */
    const int16_t L_frame,         /* i  : frame length at internal Fs                      */
    const int16_t last_L_frame,    /* i  : frame length of the last frame at internal Fs    */
    const int32_t last_core_brate, /* i  : previous frame core bitrate                      */
    const int16_t VAD              /* i  : VAD flag in the decoder                          */
void generate_comfort_noise_dec(
    float **bufferReal,     /* o  : Real part of input bands      */
    float **bufferImag,     /* o  : Imaginary part of input bands */
    Decoder_State *st,      /* i/o: decoder state structure       */
    const int16_t nchan_out /* i  : number of output channels     */
);

/*! r: CNG energy */
float cng_energy(
    const int16_t element_mode, /* i  : element mode                            */
@@ -8777,40 +8773,40 @@ void ReadFromBitstream(
    int16_t **pStream,
    int16_t *pnSize );

void const *GetTnsFilterOrder( void const *p, int16_t index, int16_t *pValue );
void *SetTnsFilterOrder( void *p, int16_t index, int16_t value );
void const *GetNumOfTnsFilters( void const *p, int16_t index, int16_t *pValue );
void *SetNumOfTnsFilters( void *p, int16_t index, int16_t value );
void const *GetTnsEnabled( void const *p, int16_t index, int16_t *pValue );
void *SetTnsEnabled( void *p, int16_t index, int16_t value );
void const *GetTnsEnabledSingleFilter( void const *p, int16_t index, int16_t *pValue );
void *SetTnsEnabledSingleFilter( void *p, int16_t index, int16_t value );
void const *GetTnsFilterCoeff( void const *p, int16_t index, int16_t *pValue );
void *SetTnsFilterCoeff( void *p, int16_t index, int16_t value );

void const *GetTnsOnWhite( void const *p, int16_t index, int16_t *pValue );
void *SetTnsOnWhite( void *p, int16_t index, int16_t value );

int16_t GetSWBTCX10TnsFilterCoeffBits( int16_t value, int16_t index );
int16_t EncodeSWBTCX10TnsFilterCoeff( int16_t value, int16_t index );
int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue );
int16_t GetSWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index );
int16_t EncodeSWBTCX20TnsFilterCoeff( int16_t value, int16_t index );
int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue );

int16_t GetWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index );
int16_t EncodeWBTCX20TnsFilterCoeff( int16_t, int16_t index );
int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue );

int16_t GetTnsFilterOrderBitsSWBTCX10( int16_t value, int16_t index );
int16_t EncodeTnsFilterOrderSWBTCX10( int16_t value, int16_t index );
int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, int16_t index, int16_t *pValue );
int16_t GetTnsFilterOrderBitsSWBTCX20( int16_t value, int16_t index );
int16_t EncodeTnsFilterOrderSWBTCX20( int16_t value, int16_t index );
int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, int16_t index, int16_t *pValue );
int16_t GetTnsFilterOrderBits( int16_t value, int16_t index );
int16_t EncodeTnsFilterOrder( int16_t value, int16_t index );
int16_t DecodeTnsFilterOrder( Decoder_State *st, int16_t index, int16_t *pValue );
void const *GetTnsFilterOrder( void const *p, const int16_t index, int16_t *pValue );
void *SetTnsFilterOrder( void *p, const int16_t index, const int16_t value );
void const *GetNumOfTnsFilters( void const *p, const int16_t index, int16_t *pValue );
void *SetNumOfTnsFilters( void *p, const int16_t index, const int16_t value );
void const *GetTnsEnabled( void const *p, const int16_t index, int16_t *pValue );
void *SetTnsEnabled( void *p, const int16_t index, const int16_t value );
void const *GetTnsEnabledSingleFilter( void const *p, const int16_t index, int16_t *pValue );
void *SetTnsEnabledSingleFilter( void *p, const int16_t index, const int16_t value );
void const *GetTnsFilterCoeff( void const *p, const int16_t index, int16_t *pValue );
void *SetTnsFilterCoeff( void *p, const int16_t index, const int16_t value );

void const *GetTnsOnWhite( void const *p, const int16_t index, int16_t *pValue );
void *SetTnsOnWhite( void *p, const int16_t index, const int16_t value );

int16_t GetSWBTCX10TnsFilterCoeffBits( const int16_t value, const int16_t index );
int16_t EncodeSWBTCX10TnsFilterCoeff( const int16_t value, const int16_t index );
int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue );
int16_t GetSWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index );
int16_t EncodeSWBTCX20TnsFilterCoeff( const int16_t value, const int16_t index );
int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue );

int16_t GetWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index );
int16_t EncodeWBTCX20TnsFilterCoeff( const int16_t, const int16_t index );
int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue );

int16_t GetTnsFilterOrderBitsSWBTCX10( const int16_t value, const int16_t index );
int16_t EncodeTnsFilterOrderSWBTCX10( const int16_t value, const int16_t index );
int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, const int16_t index, int16_t *pValue );
int16_t GetTnsFilterOrderBitsSWBTCX20( const int16_t value, const int16_t index );
int16_t EncodeTnsFilterOrderSWBTCX20( const int16_t value, const int16_t index );
int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, const int16_t index, int16_t *pValue );
int16_t GetTnsFilterOrderBits( const int16_t value, const int16_t index );
int16_t EncodeTnsFilterOrder( const int16_t value, const int16_t index );
int16_t DecodeTnsFilterOrder( Decoder_State *st, const int16_t index, int16_t *pValue );

void ResetTnsData(
    STnsData *pTnsData );
Loading