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

add switch for deactivation of the 5ms flag and the non-JBM decoding path

parent 2df5ead6
Loading
Loading
Loading
Loading
+76 −15
Original line number Diff line number Diff line
@@ -129,7 +129,11 @@ typedef struct
#endif
    IVAS_DEC_COMPLEXITY_LEVEL complexityLevel;
    bool tsmEnabled;
#ifndef REMOVE_5MS_FLAG
    bool enable5ms;
#else
    RENDER_FRAMESIZE renderFramesize;
#endif
#ifdef DEBUGGING
    IVAS_DEC_FORCED_REND_MODE forcedRendMode;
#ifdef DEBUG_FOA_AGC
@@ -502,7 +506,12 @@ int main(
#endif

    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig,
                                       arg.tsmEnabled, arg.enable5ms,
                                       arg.tsmEnabled,
#ifndef REMOVE_5MS_FLAG
                                       arg.enable5ms,
#else
                                       arg.renderFramesize,
#endif
                                       arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -1055,7 +1064,11 @@ static bool parseCmdlIVAS_dec(
    arg->Opt_non_diegetic_pan = 0;
    arg->non_diegetic_pan_gain = 0.f;
    arg->tsmEnabled = false;
#ifndef REMOVE_5MS_FLAG
    arg->enable5ms = false;
#else
    arg->renderFramesize = RENDER_FRAMESIZE_20MS;
#endif
#ifdef DEBUGGING
#ifdef VARIABLE_SPEED_DECODING
    arg->tsmScale = 100;
@@ -1281,11 +1294,46 @@ static bool parseCmdlIVAS_dec(
            arg->headrotTrajFileName = argv[i];
            i++;
        }
#ifndef REMOVE_5MS_FLAG
        else if ( strcmp( argv_to_upper, "-FR5" ) == 0 )
        {
            arg->enable5ms = true;
            i++;
        }
#else
        else if ( strcmp( argv_to_upper, "-FR" ) == 0 )
        {
            int32_t tmp;
            i++;
            if ( i < argc - 3 )
            {
                if ( !is_digits_only( argv[i] ) )
                {
                    return false;
                }

                if ( sscanf( argv[i], "%d", &tmp ) > 0 )
                {
                    i++;
                }
                switch ( (int16_t) tmp )
                {
                    case 5:
                        arg->renderFramesize = RENDER_FRAMESIZE_5MS;
                        break;
                    case 10:
                        arg->renderFramesize = RENDER_FRAMESIZE_10MS;
                        break;
                    case 20:
                        arg->renderFramesize = RENDER_FRAMESIZE_20MS;
                    default:
                        fprintf( stderr, "Error: Invalid render frame size %d \n\n", tmp );
                        usage_dec();
                        return false;
                }
            }
        }
#endif
        else if ( strcmp( argv_to_upper, "-OTR" ) == 0 )
        {

@@ -1550,10 +1598,12 @@ static bool parseCmdlIVAS_dec(
        return false;
    }

#ifndef REMOVE_5MS_FLAG
    if ( ( !arg->enableHeadRotation ) && ( !arg->enableExternalOrientation ) )
    {
        arg->enable5ms = false;
    }
#endif

    return true;
}
@@ -1610,7 +1660,11 @@ static void usage_dec( void )
    fprintf( stdout, "-VOIP_framesize     : VoIP mode: acoustic frontend fetch frame size (must be multiples of 5!)\n" );
#endif
#endif
#ifndef REMOVE_5MS_FLAG
    fprintf( stdout, "-fr5                : option to perform rendering + head-tracking with 5ms frame size\n" );
#else
    fprintf( stdout, "-fr                 : render frame size in ms (5,10,20, default is 20)\n" );
#endif
    fprintf( stdout, "-fec_cfg_file       : Optimal channel aware configuration computed by the JBM   \n" );
    fprintf( stdout, "                      as described in Section 6.3.1 of TS26.448. The output is \n" );
    fprintf( stdout, "                      written into a .txt file. Each line contains the FER indicator \n" );
@@ -2075,6 +2129,10 @@ static ivas_error decodeG192(
    nSamplesAvailableNext = 0;

    vec_pos_update = 0;
#ifdef REMOVE_5MS_FLAG
    nOutSamples = (int16_t) ( arg.output_Fs * arg.renderFramesize / 1000 * HEADROTATION_FETCH_FRAMESIZE_MS );
    vec_pos_len = (int16_t) ( IVAS_MAX_PARAM_SPATIAL_SUBFRAMES / arg.renderFramesize );
#else
    if ( arg.enableHeadRotation && arg.enable5ms )
    {
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * HEADROTATION_FETCH_FRAMESIZE_MS );
@@ -2085,7 +2143,7 @@ static ivas_error decodeG192(
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * DEFAULT_FETCH_FRAMESIZE_MS );
        vec_pos_len = 1;
    }

#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
    splitRendBits.bits_buf = splitRendBitsBuf;
    splitRendBits.bits_read = 0;
@@ -2141,11 +2199,15 @@ static ivas_error decodeG192(
                goto cleanup;
            }
        }
#ifndef REMOVE_5MS_FLAG
        int16_t enable5ms, num_subframes;
        IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms );
        arg.enable5ms = enable5ms;
        num_subframes = ( arg.enable5ms ) ? 1 : IVAS_MAX_PARAM_SPATIAL_SUBFRAMES;

#else
        int16_t num_subframes;
        num_subframes = (int16_t) arg.renderFramesize;
#endif
        /* Head-tracking input simulation */
        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
@@ -2893,16 +2955,8 @@ static ivas_error decodeVoIP(

#ifdef NONBE_UNIFIED_DECODING_PATHS
    vec_pos_update = 0;
    if ( arg.enableHeadRotation && arg.enable5ms )
    {
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * HEADROTATION_FETCH_FRAMESIZE_MS );
        vec_pos_len = IVAS_MAX_PARAM_SPATIAL_SUBFRAMES;
    }
    else
    {
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * DEFAULT_FETCH_FRAMESIZE_MS );
        vec_pos_len = 1;
    }
    nOutSamples = (int16_t) ( arg.output_Fs * arg.renderFramesize / 1000 * HEADROTATION_FETCH_FRAMESIZE_MS );
    vec_pos_len = (int16_t) ( IVAS_MAX_PARAM_SPATIAL_SUBFRAMES / arg.renderFramesize );
#endif

    for (
@@ -3062,10 +3116,15 @@ static ivas_error decodeVoIP(
                goto cleanup;
            }
        }
#ifndef REMOVE_5MS_FLAG
        int16_t enable5ms, num_subframes;
        IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms );
        arg.enable5ms = enable5ms;
        num_subframes = ( arg.enable5ms ) ? 1 : IVAS_MAX_PARAM_SPATIAL_SUBFRAMES;
#else
        int16_t num_subframes;
        num_subframes = (int16_t) arg.renderFramesize;
#endif

        /* Head-tracking input simulation */
        /* Head-tracking input simulation */
@@ -3364,7 +3423,9 @@ static ivas_error decodeVoIP(
        {
            fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame );
        }

#ifdef NONBE_UNIFIED_DECODING_PATHS
        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
#endif
        frame++;
        systemTime_ms += systemTimeInc_ms;

+10 −0
Original line number Diff line number Diff line
@@ -198,6 +198,16 @@ typedef enum
    HEAD_ORIENT_TRK_REF_VEC_LEV
} HEAD_ORIENT_TRK_T;

#ifdef REMOVE_5MS_FLAG
typedef enum
{
    RENDER_FRAMESIZE_UNKNOWN = 0,
    RENDER_FRAMESIZE_5MS = 1,
    RENDER_FRAMESIZE_10MS = 2,
    RENDER_FRAMESIZE_20MS = 4
} RENDER_FRAMESIZE;
#endif

typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
typedef struct ivas_masa_decoder_ext_out_meta_struct *MASA_DECODER_EXT_OUT_META_HANDLE;

+3 −1
Original line number Diff line number Diff line
@@ -168,7 +168,9 @@
#define NONBE_FIX_736_FOA_BR_SWITCH                           /* FhG/Dlb : Issue 736: FOA bitrate switching decoding crashes in in ivas_spar_to_dirac */
#define NONBE_FIX_746_NONDIEGETIC_MD                          /* Eri: Issue 746: The non-diegetic panning flag affects the encoder bitstream even if extended metadata is not enabled. Crashes the decoder.*/
#define NONBE_UNIFIED_DECODING_PATHS                          /* FhG: unify decoding paths   */

#ifdef NONBE_UNIFIED_DECODING_PATHS
#define REMOVE_5MS_FLAG
#endif
/* ##################### End NON-BE switches ############################# */

/* ################## End DEVELOPMENT switches ######################### */
+2 −0
Original line number Diff line number Diff line
@@ -975,7 +975,9 @@ ivas_error ivas_dirac_dec_config(
    if ( dec_config_flag == DIRAC_OPEN )
    {
        if (
#ifndef REMOVE_5MS_FLAG
            st_ivas->hDecoderConfig->Opt_5ms &&
#endif
            st_ivas->hTcBuffer == NULL )
        {
            if ( st_ivas->ivas_format == SBA_FORMAT )
+22 −4
Original line number Diff line number Diff line
@@ -994,7 +994,12 @@ ivas_error ivas_init_decoder_front(
    if ( st_ivas->hDecoderConfig->Opt_ExternalOrientation )
    {
        if ( ( error = ivas_external_orientation_open( &( st_ivas->hExtOrientationData ),
                                                       ( st_ivas->hDecoderConfig->Opt_5ms ) ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES ) ) != IVAS_ERR_OK )
#ifdef REMOVE_5MS_FLAG
                                                       st_ivas->hDecoderConfig->render_framesize
#else
                                                       ( st_ivas->hDecoderConfig->Opt_5ms ) ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES
#endif
                                                       ) ) != IVAS_ERR_OK )
        {
            return error;
        }
@@ -1010,7 +1015,12 @@ ivas_error ivas_init_decoder_front(
#ifdef NONBE_UNIFIED_DECODING_PATHS
                                                       st_ivas->hDecoderConfig->output_Fs,
#endif
                                                       ( st_ivas->hDecoderConfig->Opt_5ms ) ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES ) ) != IVAS_ERR_OK )
#ifdef REMOVE_5MS_FLAG
                                                       st_ivas->hDecoderConfig->render_framesize
#else
                                                       ( st_ivas->hDecoderConfig->Opt_5ms ) ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES
#endif
                                                       ) ) != IVAS_ERR_OK )
        {
            return error;
        }
@@ -1940,8 +1950,9 @@ ivas_error ivas_init_decoder(
            }
        }


#ifndef REMOVE_5MS_FLAG
        if ( st_ivas->hDecoderConfig->Opt_5ms )
#endif
        {
            granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES );
            n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas );
@@ -1989,7 +2000,9 @@ ivas_error ivas_init_decoder(

        st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns;

#ifndef REMOVE_5MS_FLAG
        if ( st_ivas->hDecoderConfig->Opt_5ms )
#endif
        {
            if ( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) )
            {
@@ -2164,7 +2177,9 @@ ivas_error ivas_init_decoder(
     * Allocate and initialize JBM struct + buffer
     *-----------------------------------------------------------------*/
    if (
#ifndef REMOVE_5MS_FLAG
        st_ivas->hDecoderConfig->Opt_5ms &&
#endif
        st_ivas->hTcBuffer == NULL )

    {
@@ -2200,8 +2215,9 @@ ivas_error ivas_init_decoder(
    /*-----------------------------------------------------------------*
     * Allocate floating-point output audio buffers
     *-----------------------------------------------------------------*/

#ifndef REMOVE_5MS_FLAG
    if ( !st_ivas->hDecoderConfig->Opt_5ms )
#endif
    {
        for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas ); n++ )
        {
@@ -2212,10 +2228,12 @@ ivas_error ivas_init_decoder(
            }
        }
    }
#ifndef REMOVE_5MS_FLAG
    else
    {
        n = 0;
    }
#endif

    for ( ; n < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; n++ )
    {
Loading