Commit 86e1472a authored by vaclav's avatar vaclav
Browse files

Merge branch '1954-ref-PortFlpMr2069' into 'ivas-float-update'

Port MR2069 from float to FLP-ref - Simplification of lib_dec.c

See merge request !2165
parents 73ca99d0 d3f38c0e
Loading
Loading
Loading
Loading
Loading
+65 −2
Original line number Diff line number Diff line
@@ -429,7 +429,6 @@ int main(
        }
    }


    /*------------------------------------------------------------------------------------------*
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/
@@ -437,8 +436,14 @@ int main(
    asked_frame_size = arg.renderFramesize;

    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;

#ifdef LIB_DEC_REVISION
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain,
                                       arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain,
                                       arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -1049,18 +1054,30 @@ static bool parseCmdlIVAS_dec(

        if ( strcmp( argv_to_upper, "-VOIP" ) == 0 )
        {
#ifdef LIB_DEC_REVISION
            arg->voipMode = true;
#else
            arg->voipMode = 1;
#endif
            i++;
        }
        else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=0" ) == 0 )
        {
#ifdef LIB_DEC_REVISION
            arg->voipMode = true;
#else
            arg->voipMode = 1;
#endif
            arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP;
            i++;
        }
        else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=1" ) == 0 )
        {
#ifdef LIB_DEC_REVISION
            arg->voipMode = true;
#else
            arg->voipMode = 1;
#endif
            arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF;
            i++;
        }
@@ -1210,6 +1227,10 @@ static bool parseCmdlIVAS_dec(
            {
                if ( !is_digits_only( argv[i] ) )
                {
#ifdef LIB_DEC_REVISION
                    fprintf( stderr, "Error: Render frame size is invalid or not specified!\n\n" );
                    usage_dec();
#endif
                    return false;
                }

@@ -1845,6 +1866,7 @@ static ivas_error initOnFirstGoodFrame(
        return error;
    }

#ifndef LIB_DEC_REVISION
    int32_t pcmFrameSize;

    if ( ( error = IVAS_DEC_GetPcmFrameSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK )
@@ -1852,7 +1874,7 @@ static ivas_error initOnFirstGoodFrame(
        fprintf( stderr, "\nError in IVAS_DEC_GetPcmFrameSize, error code: %d\n", error );
        return error;
    }

#endif
    if ( isSplitRend )
    {
        /* Open split rendering metadata writer */
@@ -1910,7 +1932,24 @@ static ivas_error initOnFirstGoodFrame(
        }
    }


#ifdef LIB_DEC_REVISION
    int16_t pcmFrameSize;
    if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError in IVAS_DEC_GetOutputBufferSize, error code: %d\n", error );
        return error;
    }

#endif
    int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) );
#ifdef LIB_DEC_REVISION
    if ( zeroBuf == NULL )
    {
        fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" );
        return IVAS_ERR_FAILED_ALLOC;
    }
#endif
    memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) );

    for ( int16_t i = 0; i < numInitialBadFrames; ++i )
@@ -2137,6 +2176,19 @@ static ivas_error decodeG192(
#endif
#endif

#ifdef VARIABLE_SPEED_DECODING
#ifdef LIB_DEC_REVISION
    if ( arg.tsmEnabled )
    {
        if ( ( error = IVAS_DEC_EnableTsm( hIvasDec ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_DEC_EnableTsm, code: %d\n", error );
            return error;
        }
    }

#endif
#endif
    if ( ( error = IVAS_DEC_is_split_rendering_enabled( hIvasDec, &isSplitRend ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError in IVAS_DEC_is_split_rendering_enabled, code: %d\n", error );
@@ -2561,7 +2613,11 @@ static ivas_error decodeG192(
            }
            else
            {
#ifdef LIB_DEC_REVISION
                if ( ( error = IVAS_DEC_GetSamplesRenderer( hIvasDec, nSamplesToRender, IVAS_DEC_PCM_INT16, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK )
#else
                if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, IVAS_DEC_PCM_INT16, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
@@ -3459,7 +3515,11 @@ static ivas_error decodeVoIP(
        {
            if ( ( error = IVAS_DEC_HasDecodedFirstGoodFrame( hIvasDec, &decodedGoodFrame ) ) != IVAS_ERR_OK )
            {
#ifdef LIB_DEC_REVISION
                fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) );
#else
                fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame, code: %d\n", error );
#endif
                goto cleanup;
            }

@@ -3471,6 +3531,9 @@ static ivas_error decodeVoIP(
                if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, NULL, delayNumSamples_orig, &delayNumSamples, &delayTimeScale,
                                                     &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK )
                {
#ifdef LIB_DEC_REVISION
                    fprintf( stderr, "Error in initOnFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) );
#endif
                    goto cleanup;
                }
            }
+4 −1
Original line number Diff line number Diff line
@@ -817,8 +817,11 @@ void ivas_apply_non_diegetic_panning(
 *----------------------------------------------------------------------------------*/

ivas_error ivas_jbm_dec_tc(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                      */
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                                      */
#ifndef LIB_DEC_REVISION
    ,
    float *data                                                 /* o  : output synthesis signals                                    */
#endif
);

ivas_error ivas_jbm_dec_render(
+1 −0
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@
#define FIX_1384_MSAN_ivas_spar_dec_open                /* VA: issue 1386: fix use-of-uninitialized value in ivas_spar_dec_open() */
#define FIX_1388_MSAN_ivas_init_decoder                 /* VA: issue 1388: fix use-of-uninitialized value in ivas_init_decoder() */
#define FIX_1288_SPLIT_REND_XSAN                        /* Dlb: Fix asan, msan and usan issues in split rendering mode*/
#define LIB_DEC_REVISION                                /* VA: cleaning and simplification of lib_dec.c */

// object-editing feature porting
#define OBJ_EDITING_API                                 /* object editing changes related to the API */
+9 −2
Original line number Diff line number Diff line
@@ -66,8 +66,11 @@ static void ivas_jbm_masa_sf_to_slot_map( Decoder_Struct *st_ivas, const int16_t
 *--------------------------------------------------------------------------*/

ivas_error ivas_jbm_dec_tc(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure         */
    Decoder_Struct *st_ivas /* i/o: IVAS decoder structure         */
#ifndef LIB_DEC_REVISION
    ,
    float *data /* o  : transport channel signals      */
#endif
)
{
    int16_t n, output_frame, nchan_out;
@@ -727,11 +730,15 @@ ivas_error ivas_jbm_dec_tc(
     * Write IVAS transport channels
     *----------------------------------------------------------------*/

#ifdef LIB_DEC_REVISION
    if ( st_ivas->hDecoderConfig->Opt_tsm == 0 )
#else
    if ( st_ivas->hDecoderConfig->Opt_tsm == 1 )
    {
        ivas_syn_output_f( p_output, output_frame, st_ivas->hTcBuffer->nchan_transport_jbm, data );
    }
    else
#endif
    {
        /* directly copy to tc buffers */
        ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, output_frame );
+417 −51

File changed.

Preview size limit exceeded, changes collapsed.

Loading