Commit 6d2d339b authored by bayers's avatar bayers
Browse files

add float capable interface (at least needed for split rendering BE)

parent c810f632
Loading
Loading
Loading
Loading
+46 −6
Original line number Diff line number Diff line
@@ -438,6 +438,7 @@ int main(
/*------------------------------------------------------------------------------------------*
 * Configure the decoder
 *------------------------------------------------------------------------------------------*/
#ifndef API_5MS
#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM )
    {
@@ -447,6 +448,8 @@ int main(
#endif
    }
#endif
#endif

#ifdef API_5MS
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.tsmEnabled,
#ifdef API_5MS_BASELINE
@@ -461,6 +464,24 @@ int main(
        goto cleanup;
    }


    /*------------------------------------------------------------------------------------------*
     * Configure VoIP mode
     *------------------------------------------------------------------------------------------*/

#ifdef API_5MS
#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM )
    {
        if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }
    }
#endif
#endif

    /*------------------------------------------------------------------------------------------*
     * Configure VoIP mode
     *------------------------------------------------------------------------------------------*/
@@ -2142,7 +2163,14 @@ static ivas_error decodeG192(
            else
            {
#endif
                error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, pcmBuf + nOutChannels * nSamplesRendered, &nSamplesRendered_loop, &needNewFrame );
                error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender,
#ifdef API_5MS
                                             IVAS_DEC_PCM_INT16,
                                             (void *)
#endif
                                                 ( pcmBuf + nOutChannels * nSamplesRendered ),
                                             &nSamplesRendered_loop,
                                             &needNewFrame );
                nSamplesRendered += nSamplesRendered_loop;
                nSamplesToRender -= nSamplesRendered_loop;
                if ( error != IVAS_ERR_OK )
@@ -2385,7 +2413,13 @@ static ivas_error decodeG192(
        }

        /* decode and get samples */
        if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, pcmBuf, &nSamplesFlushed ) ) != IVAS_ERR_OK )
        if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples,
#ifdef API_5MS
                                       IVAS_DEC_PCM_INT16,
                                       (void *)
#endif
                                           pcmBuf,
                                       &nSamplesFlushed ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_DEC_VoIP_Flush: %s\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
@@ -3350,7 +3384,13 @@ static ivas_error decodeVoIP(


        /* decode and get samples */
        if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms
        if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples,
#ifdef API_5MS
                                                 IVAS_DEC_PCM_INT16,
                                                 (void *)
#endif
                                                     pcmBuf,
                                                 systemTime_ms
#ifndef API_5MS
                                                 ,
                                                 &nSamplesAvailableNext
+10 −0
Original line number Diff line number Diff line
@@ -165,6 +165,16 @@ typedef enum

} RENDERER_TYPE;


#ifdef API_5MS
typedef enum
{
    PCM_INT16,
    PCM_FLOAT32,
    PCM_NOT_KNOW = 0xffff
} PCM_RESOLUTION;
#endif

/*----------------------------------------------------------------------------------*
 * IVAS general constants
 *----------------------------------------------------------------------------------*/
+34 −4
Original line number Diff line number Diff line
@@ -308,7 +308,12 @@ void stereo_dmx_evs_close_encoder(
#if !defined(API_5MS) || defined (API_5MS_BASELINE) 
ivas_error ivas_dec(
    Decoder_Struct *st_ivas,                                    /* i  : IVAS decoder structure                  */
#ifdef API_5MS
    const PCM_RESOLUTION pcm_resolution, /* i  : type for the decoded PCM resolution */
    void *data    /* o  : output synthesis signal     */
#else
    int16_t *data                                               /* o  : output synthesis signal                 */
#endif
#if defined SPLIT_REND_WITH_HEAD_ROT && !defined(API_5MS)
    ,
    IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits
@@ -325,7 +330,12 @@ ivas_error ivas_dec_init_split_rend(
ivas_error ivas_dec_setup(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    uint16_t *nSamplesRendered,                                 /* o  : number of samples flushed from the previous frame (JBM) */
    int16_t *data                                               /* o  : flushed PCM samples                                     */
#ifdef API_5MS
    const PCM_RESOLUTION pcm_resolution, /* i  : type for the decoded PCM resolution */
    void *data                           /* o  : output synthesis signal     */
#else
    int16_t *data /* o  : output synthesis signal                 */
#endif
);

ivas_error create_sce_dec(
@@ -665,7 +675,12 @@ ivas_error ivas_mc_dec_config(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    const int16_t idx,                                          /* i  : LS config. index                        */
    uint16_t *nSamplesRendered,                                 /* o  : samples flushed from last frame (JBM)   */
    int16_t *data                                               /* o  : flushed samples (JBM)                   */
#ifdef API_5MS
    const PCM_RESOLUTION pcm_resolution, /* i  : type for the decoded PCM resolution */
    void *data                           /* o  : output synthesis signal     */
#else
    int16_t *data /* o  : output synthesis signal                 */
#endif
);

/*! r: MC format mode (MCT, McMASA, ParamMC) */
@@ -780,7 +795,12 @@ ivas_error ivas_jbm_dec_render(
    const uint16_t nSamplesAsked,                               /* i  : number of samples wanted                                    */
    uint16_t *nSamplesRendered,                                 /* o  : number of samples rendered                                  */
    uint16_t *nSamplesAvailableNext,                            /* o  : number of samples still available in the rendering pipeline */
#ifdef API_5MS
    const PCM_RESOLUTION pcm_resolution,                        /* i  : type for the decoded PCM resolution                         */
    void *data                                                  /* o  : output synthesis signal                                     */
#else
    int16_t *data                                               /* o  : output synthesis signal                                     */
#endif
);

ivas_error ivas_jbm_dec_flush_renderer(
@@ -792,7 +812,12 @@ ivas_error ivas_jbm_dec_flush_renderer(
    const MC_MODE mc_mode_old,                                  /* i  : old MC mode                                                 */
    const ISM_MODE ism_mode_old,                                /* i  : old ISM mode                                                */
    uint16_t *nSamplesRendered,                                 /* o  : number of samples flushed                                   */
    int16_t *data                                               /* o  : rendered samples                                            */
#ifdef API_5MS
    const PCM_RESOLUTION pcm_resolution, /* i  : type for the decoded PCM resolution */
    void *data                           /* o  : output synthesis signal     */
#else
    int16_t *data /* o  : output synthesis signal                 */
#endif
);

ivas_error ivas_jbm_dec_feed_tc_to_renderer(
@@ -1080,7 +1105,12 @@ 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                               */
    uint16_t *nSamplesRendered,                                 /* o  : number of samples flushed on renderer change*/
    int16_t *data                                               /* o  : flushed PCM samples                         */
#ifdef API_5MS
    const PCM_RESOLUTION pcm_resolution, /* i  : type for the decoded PCM resolution */
    void *data                           /* o  : output synthesis signal     */
#else
    int16_t *data /* o  : output synthesis signal                 */
#endif
);

ivas_error ivas_param_ism_dec_open(
+40 −4
Original line number Diff line number Diff line
@@ -54,7 +54,12 @@

ivas_error ivas_dec(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure      */
#ifdef API_5MS
    const PCM_RESOLUTION pcm_resolution, /* i  : type for the decoded PCM resolution */
    void *data                           /* o  : output synthesis signal     */
#else
    int16_t *data /* o  : output synthesis signal     */
#endif
#if defined SPLIT_REND_WITH_HEAD_ROT && !defined( API_5MS )
    ,
    IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits
@@ -97,7 +102,11 @@ ivas_error ivas_dec(

    if ( st_ivas->bfi == 0 )
    {
        if ( ( error = ivas_dec_setup( st_ivas, NULL, NULL ) ) != IVAS_ERR_OK )
        if ( ( error = ivas_dec_setup( st_ivas, NULL,
#ifdef API_5MS
                                       PCM_NOT_KNOW,
#endif
                                       NULL ) ) != IVAS_ERR_OK )
        {
            return error;
        }
@@ -1052,15 +1061,42 @@ ivas_error ivas_dec(
     *   - compensation for saturation
     *   - float to integer conversion
     *----------------------------------------------------------------*/
#ifndef DISABLE_LIMITER
    ivas_limiter_dec( st_ivas->hLimiter, p_output, nchan_out, output_frame, st_ivas->BER_detect );

#ifdef API_5MS
    if ( st_ivas->hDecoderConfig->Opt_Limiter )
#endif
    {
        ivas_limiter_dec( st_ivas->hLimiter, p_output, nchan_out, output_frame, st_ivas->BER_detect );
    }

#ifdef DEBUGGING
    st_ivas->noClipping +=
#endif
        ivas_syn_output( p_output, output_frame, nchan_out, data );
#ifdef API_5MS
    switch ( pcm_resolution )
    {
        case PCM_INT16:
#endif
#ifdef DEBUGGING
            st_ivas->noClipping +=
#endif
                ivas_syn_output( p_output, output_frame, nchan_out,
#ifdef API_5MS
                                 (int16_t *)
#endif
                                     data );

#ifdef API_5MS
            break;
        case PCM_FLOAT32:
            ivas_syn_output_f( p_output, output_frame, nchan_out, (float *) data );
            break;
        default:
            error = IVAS_ERR_UNKNOWN;
            break;
    }
#endif
    /*----------------------------------------------------------------*
     * Common updates
     *----------------------------------------------------------------*/
+22 −4
Original line number Diff line number Diff line
@@ -216,7 +216,12 @@ ivas_error ivas_dec_init_split_rend(
ivas_error ivas_dec_setup(
    Decoder_Struct *st_ivas,    /* i/o: IVAS decoder structure      */
    uint16_t *nSamplesRendered, /* o  : number of samples flushed from the previous frame (JBM) */
    int16_t *data               /* o  : flushed PCM samples                                     */
#ifdef API_5MS
    const PCM_RESOLUTION pcm_resolution, /* i  : type for the decoded PCM resolution */
    void *data                           /* o  : output synthesis signal     */
#else
    int16_t *data /* o  : output synthesis signal                 */
#endif
)
{
    int16_t k, idx, num_bits_read;
@@ -267,7 +272,11 @@ ivas_error ivas_dec_setup(

            st_ivas->nchan_ism = nchan_ism;

            if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK )
            if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered,
#ifdef API_5MS
                                                pcm_resolution,
#endif
                                                data ) ) != IVAS_ERR_OK )
            {
                return error;
            }
@@ -380,7 +389,12 @@ ivas_error ivas_dec_setup(
            num_bits_read += MC_LS_SETUP_BITS;

            /* select MC format mode; reconfigure the MC format decoder */
            ivas_mc_dec_config( st_ivas, idx, nSamplesRendered, data );
            ivas_mc_dec_config( st_ivas, idx, nSamplesRendered,
#ifdef API_5MS
                                pcm_resolution,
#endif

                                data );
        }

        /*-------------------------------------------------------------------*
@@ -495,7 +509,11 @@ ivas_error ivas_dec_setup(
                st_ivas->ism_mode = (ISM_MODE) ( idx + 1 );
            }

            if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK )
            if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered,
#ifdef API_5MS
                                                pcm_resolution,
#endif
                                                data ) ) != IVAS_ERR_OK )
            {
                return error;
            }
Loading