Commit 3ecf34f4 authored by vaclav's avatar vaclav
Browse files

more within FIX_HRTF_LOAD_JBM; fix compilation warnings

parent b24d9d29
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -3536,6 +3536,8 @@ static ivas_error decodeVoIP(
                    return error;
                }

                //nSamplesRendered += hIvasDec->nSamplesFlushed;

                /* Placeholder for memory reallocation */
                /* ... */

+24 −6
Original line number Diff line number Diff line
@@ -325,10 +325,13 @@ ivas_error ivas_dec_get_format(

#endif
ivas_error ivas_dec_setup(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
#ifndef FIX_HRTF_LOAD_JBM
    ,
    uint16_t *nSamplesRendered,                                 /* o  : number of samples flushed from the previous frame (JBM) */
    const PCM_RESOLUTION pcm_resolution,                        /* i  : type for the decoded PCM resolution     */
    void *data                                                  /* o  : output synthesis signal                 */
#endif
);

ivas_error create_sce_dec(
@@ -666,10 +669,13 @@ ivas_error ivas_mc_enc_config(

ivas_error ivas_mc_dec_config(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    const int16_t idx,                                          /* i  : LS config. index                        */
    const int16_t idx                                           /* i  : LS config. index                        */
#ifndef FIX_HRTF_LOAD_JBM
    ,
    uint16_t *nSamplesRendered,                                 /* o  : samples flushed from last frame (JBM)   */
    const PCM_RESOLUTION pcm_resolution,                        /* i  : type for the decoded PCM resolution     */
    void *data                                                  /* o  : output synthesis signal                 */
    #endif
);

/*! r: MC format mode (MCT, McMASA, ParamMC) */
@@ -1083,10 +1089,13 @@ ivas_error ivas_ism_enc_config(

ivas_error ivas_ism_dec_config(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                      */
    const ISM_MODE last_ism_mode,                               /* i/o: last ISM mode                               */
    const ISM_MODE last_ism_mode                                /* i/o: last ISM mode                               */
#ifndef FIX_HRTF_LOAD_JBM
    ,
    uint16_t *nSamplesRendered,                                 /* o  : number of samples flushed on renderer change*/
    const PCM_RESOLUTION pcm_resolution,                        /* i  : type for the decoded PCM resolution         */
    void *data                                                  /* o  : output synthesis signal                     */
#endif
);

ivas_error ivas_param_ism_dec_open(
@@ -3477,10 +3486,13 @@ void ivas_sba_set_cna_cng_flag(
);

ivas_error ivas_sba_dec_reconfigure(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
#ifndef FIX_HRTF_LOAD_JBM
    ,
    uint16_t *nSamplesFlushed,                                  /* o  : number of samples flushed               */
    const PCM_RESOLUTION pcm_resolution,                        /* i  : type for the decoded PCM resolution     */
    void *data                                                  /* o  : output synthesis signal                 */
#endif
);

ivas_error ivas_sba_digest_tc(
@@ -4935,10 +4947,13 @@ void ivas_masa_enc_reconfigure(
);

ivas_error ivas_masa_dec_reconfigure(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                          */
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                          */
#ifndef FIX_HRTF_LOAD_JBM
    ,
    uint16_t *nSamplesRendered,                                 /* o  : number of samples flushed from the previous frame (JBM) */
    const PCM_RESOLUTION pcm_resolution,                        /* i  : type for the decoded PCM resolution             */
    void *data                                                  /* o  : output synthesis signal                         */
    #endif
);

ivas_error ivas_masa_encode(
@@ -5640,10 +5655,13 @@ ivas_error ivas_omasa_enc_config(
);

ivas_error ivas_omasa_dec_config(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
#ifndef FIX_HRTF_LOAD_JBM
    ,
    uint16_t *nSamplesRendered,                                 /* o  : number of samples flushed from the previous frame (JBM) */
    const PCM_RESOLUTION pcm_resolution,                        /* i  : type for the decoded PCM resolution     */
    void *data                                                  /* o  : output synthesis signal                 */
#endif
);

void ivas_omasa_set_config(
+60 −11
Original line number Diff line number Diff line
@@ -143,7 +143,9 @@ ivas_error ivas_dec_get_format(
        else if ( st_ivas->ivas_format == ISM_FORMAT )
        {
            /* read the number of objects */
#ifndef FIX_HRTF_LOAD_JBM
            st_ivas->nchan_transport = 1;
#endif
            nchan_ism = 1;
            k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 );
            while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS )
@@ -154,6 +156,13 @@ ivas_error ivas_dec_get_format(

            st_ivas->nchan_ism = nchan_ism;
            st_ivas->ism_mode = ivas_ism_mode_select( nchan_ism, ivas_total_brate );
#ifdef FIX_HRTF_LOAD_JBM
            st_ivas->nchan_transport = nchan_ism;
            if ( st_ivas->ism_mode == ISM_MODE_PARAM )
            {
                st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE;
            }
#endif
        }
        else if ( st_ivas->ivas_format == SBA_FORMAT )
        {
@@ -318,14 +327,12 @@ ivas_error ivas_dec_get_format(
                break;
        }

        if ( st_ivas->ini_frame > 0 && st_ivas->ivas_format == SBA_FORMAT )
        {
        }

        if ( st_ivas->ivas_format == ISM_FORMAT )
        {
            /* read the number of objects */
#ifndef FIX_HRTF_LOAD_JBM
            st_ivas->nchan_transport = 1;
#endif
            nchan_ism = 1;
            k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS );
            while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS )
@@ -335,11 +342,6 @@ ivas_error ivas_dec_get_format(
            }
            k--;

            if ( st_ivas->ini_frame > 0 && nchan_ism != st_ivas->nchan_ism )
            {
                return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" );
            }

            st_ivas->nchan_ism = nchan_ism;

            /* read ism_mode */
@@ -350,6 +352,14 @@ ivas_error ivas_dec_get_format(
                idx = st_ivas->bit_stream[k];
                st_ivas->ism_mode = (ISM_MODE) ( idx + 1 );
            }

#ifdef FIX_HRTF_LOAD_JBM
            st_ivas->nchan_transport = nchan_ism;
            if ( st_ivas->ism_mode == ISM_MODE_PARAM )
            {
                st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE;
            }
#endif
        }
    }

@@ -367,10 +377,13 @@ ivas_error ivas_dec_get_format(
 *-------------------------------------------------------------------*/

ivas_error ivas_dec_setup(
    Decoder_Struct *st_ivas,             /* i/o: IVAS decoder structure                                  */
    Decoder_Struct *st_ivas /* i/o: IVAS decoder structure  */
#ifndef FIX_HRTF_LOAD_JBM
    ,
    uint16_t *nSamplesRendered,          /* o  : number of samples flushed from the previous frame (JBM) */
    const PCM_RESOLUTION pcm_resolution, /* i  : type for the decoded PCM resolution                     */
    void *data                           /* o  : output synthesis signal                                 */
#endif
)
{
    int16_t k, idx, num_bits_read;
@@ -424,7 +437,11 @@ ivas_error ivas_dec_setup(

            st_ivas->nchan_ism = nchan_ism;

#ifdef FIX_HRTF_LOAD_JBM
            if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
@@ -442,7 +459,11 @@ ivas_error ivas_dec_setup(
            num_bits_read += SBA_ORDER_BITS;
            if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate && ivas_total_brate > IVAS_SID_5k2 )
            {
#ifdef FIX_HRTF_LOAD_JBM
                if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK )
#else
                if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }
@@ -504,8 +525,11 @@ ivas_error ivas_dec_setup(
                        }
                        else
                        {

#ifdef FIX_HRTF_LOAD_JBM
                            if ( ( error = ivas_masa_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK )
#else
                            if ( ( error = ivas_masa_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
#endif
                            {
                                return error;
                            }
@@ -513,7 +537,11 @@ ivas_error ivas_dec_setup(
                    }
                    else
                    {
#ifdef FIX_HRTF_LOAD_JBM
                        if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK )
#else
                        if ( ( error = ivas_omasa_dec_config( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
#endif
                        {
                            return error;
                        }
@@ -534,7 +562,11 @@ ivas_error ivas_dec_setup(
                /* reconfigure in case a change of operation mode is detected */
                if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) )
                {
#ifdef FIX_HRTF_LOAD_JBM
                    if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK )
#else
                    if ( ( error = ivas_omasa_dec_config( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
#endif
                    {
                        return error;
                    }
@@ -562,9 +594,14 @@ ivas_error ivas_dec_setup(
                st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read];
                num_bits_read += SBA_ORDER_BITS;
            }

            if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate )
            {
#ifdef FIX_HRTF_LOAD_JBM
                if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK )
#else
                if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }
@@ -610,7 +647,11 @@ ivas_error ivas_dec_setup(
            num_bits_read += MC_LS_SETUP_BITS;

            /* select MC format mode; reconfigure the MC format decoder */
#ifdef FIX_HRTF_LOAD_JBM
            if ( ( error = ivas_mc_dec_config( st_ivas, idx ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_mc_dec_config( st_ivas, idx, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
@@ -695,7 +736,11 @@ ivas_error ivas_dec_setup(
                    st_ivas->hDecoderConfig->ivas_total_brate = IVAS_24k4;
                }

#ifdef FIX_HRTF_LOAD_JBM
                if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK )
#else
                if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }
@@ -741,7 +786,11 @@ ivas_error ivas_dec_setup(
                last_ism_mode = st_ivas->ism_mode;
            }

#ifdef FIX_HRTF_LOAD_JBM
            if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
+23 −5
Original line number Diff line number Diff line
@@ -49,10 +49,13 @@
static ivas_error ivas_ism_bitrate_switching_dec(
    Decoder_Struct *st_ivas,           /* i/o: IVAS decoder structure               */
    const int16_t nchan_transport_old, /* i  : last number of transport channels    */
    const ISM_MODE last_ism_mode,        /* i  : last ISM mode                        */
    const ISM_MODE last_ism_mode       /* i  : last ISM mode                        */
#ifndef FIX_HRTF_LOAD_JBM
    ,
    uint16_t *nSamplesRendered,          /* o  : number of samples rendered           */
    const PCM_RESOLUTION pcm_resolution, /* i  : type for the decoded PCM resolution  */
    void *data                           /* o  : output synthesis signal              */
#endif
)
{
    ivas_error error;
@@ -142,10 +145,14 @@ static ivas_error ivas_ism_bitrate_switching_dec(

        if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity )
        {
#ifdef FIX_HRTF_LOAD_JBM
            /* flush already done in IVAS_DEC_ReadFormat() */
#else
            if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
            {
                return error;
            }
#endif
        }
        /* JBM: when granularity goes up set samples to discard at the beginning of the frame */
        else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity )
@@ -374,10 +381,13 @@ static ivas_error ivas_ism_bitrate_switching_dec(

ivas_error ivas_ism_dec_config(
    Decoder_Struct *st_ivas,     /* i/o: IVAS decoder structure              */
    const ISM_MODE last_ism_mode,        /* i/o: last ISM mode                       */
    const ISM_MODE last_ism_mode /* i/o: last ISM mode                       */
#ifndef FIX_HRTF_LOAD_JBM
    ,
    uint16_t *nSamplesRendered,          /* o  : number of samples flushed when the renderer granularity changes */
    const PCM_RESOLUTION pcm_resolution, /* i  : type for the decoded PCM resolution */
    void *data                           /* o  : output synthesis signal             */
#endif
)
{
    int32_t ivas_total_brate;
@@ -415,7 +425,11 @@ ivas_error ivas_ism_dec_config(
            /* ISM bit-rate switching */
            if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) )
            {
#ifdef FIX_HRTF_LOAD_JBM
                if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK )
#else
                if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }
@@ -437,7 +451,11 @@ ivas_error ivas_ism_dec_config(
        /* ISM mode switching */
        if ( st_ivas->ism_mode != last_ism_mode )
        {
#ifdef FIX_HRTF_LOAD_JBM
            if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
+8 −1
Original line number Diff line number Diff line
@@ -1305,10 +1305,13 @@ static int16_t decode_lfe_to_total_energy_ratio(
 *-------------------------------------------------------------------*/

ivas_error ivas_masa_dec_reconfigure(
    Decoder_Struct *st_ivas,             /* i/o: IVAS decoder structure                                     */
    Decoder_Struct *st_ivas /* i/o: IVAS decoder structure                                     */
#ifndef FIX_HRTF_LOAD_JBM
    ,
    uint16_t *nSamplesRendered,          /* o  : number of samples flushed from the previous frame (JBM)    */
    const PCM_RESOLUTION pcm_resolution, /* i  : type for the decoded PCM resolution                        */
    void *data                           /* o  : output synthesis signal                                    */
#endif
)
{
    int16_t n, tmp, num_bits;
@@ -1517,10 +1520,14 @@ ivas_error ivas_masa_dec_reconfigure(
            {
                if ( n_samples_granularity < st_ivas->hTcBuffer->n_samples_granularity )
                {
#ifdef FIX_HRTF_LOAD_JBM
                    /* flush already done in IVAS_DEC_ReadFormat() */
#else
                    if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
                    {
                        return error;
                    }
#endif
                }
            }
        }
Loading