Commit 0bdcf007 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'ivas_ls_custom_dec_fxd_conv' into 'main'

functions in ivas_ls_custom_dec converted to fixed.

See merge request !82
parents 2bd8d8fe c308d7f6
Loading
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -707,4 +707,18 @@ Word16 stereo_dft_band_config_fx(
    const Word16 NFFT,     /* i  : analysis/synthesis window length    */
    const Word16 enc_dec   /* i  : flag to indicate enc vs dec         */
);

// ivas_ls_custom_dec.c
void ivas_ls_custom_setup_fx(
    IVAS_OUTPUT_SETUP_HANDLE hOutSetup,         /* o  : IVAS output setup handle        */
    const LSSETUP_CUSTOM_STRUCT *hLsSetupCustom /* i  : Custom loudspeaker setup handle */
);

ivas_error ivas_ls_custom_output_init_fx(
    Decoder_Struct *st_ivas /* i/o: IVAS decoder handle      */
);

ivas_error ivas_ls_custom_open_fx(
    LSSETUP_CUSTOM_HANDLE *hLsSetupCustom /* o  : Custom loudspeaker setup handle    */
);
#endif
 No newline at end of file
+22 −0
Original line number Diff line number Diff line
@@ -732,7 +732,17 @@ ivas_error ivas_init_decoder_front(

    IF ( st_ivas->hDecoderConfig->Opt_LsCustom )
    {
#ifdef IVAS_FLOAT_FIXED
        IF ( ( error = ivas_ls_custom_open_fx( &( st_ivas->hLsSetupCustom ) ) ) == IVAS_ERR_OK )
        {
            set_zero((st_ivas->hLsSetupCustom)->ls_azimuth, MAX_OUTPUT_CHANNELS );
            set_zero((st_ivas->hLsSetupCustom)->ls_elevation, MAX_OUTPUT_CHANNELS );
            set_f( ( st_ivas->hLsSetupCustom )->separate_ch_gains, 0.0f, MAX_OUTPUT_CHANNELS );
        }
        ELSE 
#else
        IF ( ( error = ivas_ls_custom_open( &( st_ivas->hLsSetupCustom ) ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
@@ -927,7 +937,19 @@ ivas_error ivas_init_decoder(

    IF ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM )
    {
#ifdef IVAS_FLOAT_FIXED
        IF ( ( error = ivas_ls_custom_output_init_fx( st_ivas ) ) == IVAS_ERR_OK ) {

            st_ivas->hOutSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth;
            st_ivas->hOutSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation;
            st_ivas->hIntSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth;
            st_ivas->hIntSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation;

        }
        ELSE
#else
        IF ( ( error = ivas_ls_custom_output_init( st_ivas ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
+72 −0
Original line number Diff line number Diff line
@@ -34,6 +34,10 @@
#include "ivas_prot.h"
#include "prot.h"
#include "wmc_auto.h"
#ifdef IVAS_FLOAT_FIXED
#include "ivas_prot_fx.h"
#include "prot_fx1.h"
#endif


/*-----------------------------------------------------------------------*
@@ -67,6 +71,32 @@ ivas_error ivas_ls_custom_open(
    return IVAS_ERR_OK;
}

#ifdef IVAS_FLOAT_FIXED
ivas_error ivas_ls_custom_open_fx(
    LSSETUP_CUSTOM_HANDLE *hLsSetupCustom /* o  : Custom loudspeaker setup handle    */
)
{
    /* Allocate handle */
    IF ( ( *hLsSetupCustom = (LSSETUP_CUSTOM_HANDLE) malloc( sizeof( LSSETUP_CUSTOM_STRUCT ) ) ) == NULL )
    {
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Custom LS layout memory\n" ) );
    }

    ( *hLsSetupCustom )->num_spk = -1;
    ( *hLsSetupCustom )->is_planar_setup = -1;

    set16_fx( ( *hLsSetupCustom )->ls_azimuth_fx, 0, MAX_OUTPUT_CHANNELS );
    set16_fx( ( *hLsSetupCustom )->ls_elevation_fx, 0, MAX_OUTPUT_CHANNELS );

    ( *hLsSetupCustom )->num_lfe = -1;
    set_s( ( *hLsSetupCustom )->lfe_idx, -1, MAX_OUTPUT_CHANNELS );

    ( *hLsSetupCustom )->separate_ch_found = -1;

    set16_fx( ( *hLsSetupCustom )->separate_ch_gains_fx, 0, MAX_OUTPUT_CHANNELS );
    return IVAS_ERR_OK;
}
#endif

/*-------------------------------------------------------------------------*
 * ivas_output_init_ls_custom()
@@ -94,6 +124,29 @@ void ivas_ls_custom_setup(
    return;
}

#ifdef IVAS_FLOAT_FIXED
void ivas_ls_custom_setup_fx(
    IVAS_OUTPUT_SETUP_HANDLE hOutSetup,         /* o  : IVAS output setup handle        */
    const LSSETUP_CUSTOM_STRUCT *hLsSetupCustom /* i  : Custom loudspeaker setup handle */
)
{
    hOutSetup->output_config = IVAS_AUDIO_CONFIG_LS_CUSTOM;

    hOutSetup->nchan_out_woLFE = hLsSetupCustom->num_spk;

    hOutSetup->ls_azimuth_fx = hLsSetupCustom->ls_azimuth_fx;
    hOutSetup->ls_elevation_fx = hLsSetupCustom->ls_elevation_fx;

    hOutSetup->num_lfe = hLsSetupCustom->num_lfe;
    hOutSetup->index_lfe[0] = hLsSetupCustom->lfe_idx[0]; /* IVAS_OUTPUT_SETUP only supports 1 LFE */

    hOutSetup->is_loudspeaker_setup = TRUE;
    hOutSetup->is_planar_setup = (int8_t) hLsSetupCustom->is_planar_setup;

    return;
}
#endif

/*-----------------------------------------------------------------------*
 * ivas_ls_custom_output_init()
 *
@@ -116,3 +169,22 @@ ivas_error ivas_ls_custom_output_init(

    return IVAS_ERR_OK;
}

#ifdef IVAS_FLOAT_FIXED
ivas_error ivas_ls_custom_output_init_fx(
    Decoder_Struct *st_ivas /* i/o: IVAS decoder handle      */
)
{
    IF ( st_ivas->hLsSetupCustom == NULL )
    {
        return IVAS_ERR_WRONG_PARAMS;
    }

    st_ivas->hDecoderConfig->nchan_out = add( st_ivas->hLsSetupCustom->num_spk, st_ivas->hLsSetupCustom->num_lfe );

    ivas_ls_custom_setup_fx( &( st_ivas->hOutSetup ), st_ivas->hLsSetupCustom );
    ivas_ls_custom_setup_fx( &( st_ivas->hIntSetup ), st_ivas->hLsSetupCustom );

    return IVAS_ERR_OK;
}
#endif
+6 −0
Original line number Diff line number Diff line
@@ -82,6 +82,9 @@ typedef struct ivas_output_setup_structure
    const float *ls_azimuth;
    const float *ls_elevation;

    const Word16 *ls_azimuth_fx;
    const Word16 *ls_elevation_fx;

    uint8_t separateChannelEnabled;
    int16_t separateChannelIndex;

@@ -1713,6 +1716,9 @@ typedef struct ivas_LS_setup_custom
    int16_t separate_ch_found;                    /* flag to indicate if a center channel was found                           */
    float separate_ch_gains[MAX_OUTPUT_CHANNELS]; /* gains to pan McMASA separateChannel in case no center channel is present */

    Word16 ls_azimuth_fx[MAX_OUTPUT_CHANNELS];        /* custom loudspeaker azimuths                                              */
    Word16 ls_elevation_fx[MAX_OUTPUT_CHANNELS];      /* custom loudspeaker elevations                                            */
    Word16 separate_ch_gains_fx[MAX_OUTPUT_CHANNELS]; /* gains to pan McMASA separateChannel in case no center channel is present */
} LSSETUP_CUSTOM_STRUCT, *LSSETUP_CUSTOM_HANDLE;