Commit fd0c919f authored by bayers's avatar bayers
Browse files

address some comments on the MR, amend temp fix for MC RS

parent d2d05f5c
Loading
Loading
Loading
Loading
Loading
+14 −64
Original line number Diff line number Diff line
@@ -131,17 +131,13 @@ typedef struct
#ifndef REMOVE_5MS_FLAG
    bool enable5ms;
#else
    RENDER_FRAMESIZE renderFramesize;
    IVAS_RENDER_FRAMESIZE renderFramesize;
#endif
#ifdef DEBUGGING
    IVAS_DEC_FORCED_REND_MODE forcedRendMode;
#ifdef DEBUG_FOA_AGC
    FILE *agcBitstream; /* temporary */
#endif
#ifdef DEBUG_JBM_CMD_OPTION
    bool noBadFrameDelay;
    uint16_t frontendFetchSizeMs;
#endif
#ifdef VARIABLE_SPEED_DECODING
    bool tsmScaleFileEnabled;
    char *tsmScaleFileName;
@@ -630,7 +626,7 @@ int main(
#ifdef SPLIT_REND_WITH_HEAD_ROT
        if (
#ifdef REMOVE_5MS_FLAG
            arg.renderFramesize == RENDER_FRAMESIZE_5MS &&
            arg.renderFramesize == IVAS_RENDER_FRAMESIZE_5MS &&
#else
            arg.enable5ms &&
#endif
@@ -639,7 +635,7 @@ int main(
        {
/*TODO : needs to be refined as this wont work with LCLD codec*/
#ifdef REMOVE_5MS_FLAG
            arg.renderFramesize = RENDER_FRAMESIZE_5MS;
            arg.renderFramesize = IVAS_RENDER_FRAMESIZE_5MS;
#else
            arg.enable5ms = true;
#endif
@@ -647,7 +643,7 @@ int main(
        else
        {
#ifdef REMOVE_5MS_FLAG
            arg.renderFramesize = RENDER_FRAMESIZE_20MS;
            arg.renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
#else
            arg.enable5ms = true;
#endif
@@ -1054,7 +1050,7 @@ static bool parseCmdlIVAS_dec(
#ifndef REMOVE_5MS_FLAG
    arg->enable5ms = false;
#else
    arg->renderFramesize = RENDER_FRAMESIZE_20MS;
    arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
#endif
#ifdef DEBUGGING
#ifdef VARIABLE_SPEED_DECODING
@@ -1062,12 +1058,6 @@ static bool parseCmdlIVAS_dec(
    arg->tsmScaleFileEnabled = false;
    arg->tsmScaleFileName = NULL;
#endif
#ifdef DEBUG_JBM_CMD_OPTION
    arg->frontendFetchSizeMs = JBM_FRONTEND_FETCH_FRAMESIZE_MS;
#endif
#ifdef DEBUG_JBM_CMD_OPTION
    arg->noBadFrameDelay = false;
#endif
#endif
    arg->acousticEnvironmentId = 65535;
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
@@ -1203,13 +1193,6 @@ static bool parseCmdlIVAS_dec(
        }
#endif /* #ifdef DEBUG_MODE_INFO_TWEAK */
#endif /* #ifdef DEBUG_MODE_INFO */
#ifdef DEBUG_JBM_CMD_OPTION
        else if ( strcmp( argv_to_upper, "-VOIP_NO_BAD_FRAME" ) == 0 )
        {
            arg->noBadFrameDelay = true;
            i++;
        }
#endif
#ifdef VARIABLE_SPEED_DECODING
        else if ( strcmp( argv_to_upper, "-VS" ) == 0 )
        {
@@ -1243,26 +1226,6 @@ static bool parseCmdlIVAS_dec(
            }
        }
#endif
#ifdef DEBUG_JBM_CMD_OPTION
        else if ( strcmp( argv_to_upper, "-VOIP_FRAMESIZE" ) == 0 )
        {
            i++;
            int32_t tmp;
            if ( i < argc - 3 )
            {
                if ( !is_digits_only( argv[i] ) )
                {
                    return false;
                }

                if ( sscanf( argv[i], "%d", &tmp ) > 0 )
                {
                    i++;
                }
                arg->frontendFetchSizeMs = (uint16_t) tmp;
            }
        }
#endif
#endif /* #ifdef DEBUGGING */

        else if ( strcmp( argv_to_upper, "-MIME" ) == 0 )
@@ -1310,13 +1273,13 @@ static bool parseCmdlIVAS_dec(
                switch ( (int16_t) tmp )
                {
                    case 5:
                        arg->renderFramesize = RENDER_FRAMESIZE_5MS;
                        arg->renderFramesize = IVAS_RENDER_FRAMESIZE_5MS;
                        break;
                    case 10:
                        arg->renderFramesize = RENDER_FRAMESIZE_10MS;
                        arg->renderFramesize = IVAS_RENDER_FRAMESIZE_10MS;
                        break;
                    case 20:
                        arg->renderFramesize = RENDER_FRAMESIZE_20MS;
                        arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
                        break;
                    default:
                        fprintf( stderr, "Error: Invalid render frame size %d \n\n", tmp );
@@ -1690,9 +1653,6 @@ static void usage_dec( void )
    fprintf( stdout, "-VOIP               : VoIP mode: RTP in G192\n" );
    fprintf( stdout, "-VOIP_hf_only=0     : VoIP mode: EVS RTP Payload Format hf_only=0 in rtpdump\n" );
    fprintf( stdout, "-VOIP_hf_only=1     : VoIP mode: EVS RTP Payload Format hf_only=1 in rtpdump\n" );
#ifdef DEBUG_JBM_CMD_OPTION
    fprintf( stdout, "-VOIP_no_bad_frame  : VoIP mode: do not put out bad frames in the beginning as silence \n" );
#endif
    fprintf( stdout, "                      The decoder may read rtpdump files containing TS26.445 Annex A.2.2\n" );
    fprintf( stdout, "                      EVS RTP Payload Format. The SDP parameter hf_only is required.\n" );
    fprintf( stdout, "                      Reading RFC4867 AMR/AMR-WB RTP payload format is not supported.\n" );
@@ -1704,14 +1664,11 @@ static void usage_dec( void )
    fprintf( stdout, "-VS fac             : Variable Speed mode: change speed of playout fac as integer in percent.\n" );
    fprintf( stdout, "                      50 <= fac <= 150; fac<100 faster, fac>100 slower\n" );
#endif
#ifdef DEBUG_JBM_CMD_OPTION
    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" );
    fprintf( stdout, "-fr L               : render frame size in ms L=(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" );
@@ -2997,6 +2954,11 @@ static ivas_error decodeVoIP(
#ifdef NONBE_UNIFIED_DECODING_PATHS
    vec_pos_update = 0;
#ifdef REMOVE_5MS_FLAG
    if ( ( error = IVAS_DEC_GetRenderFramesizeMs( hIvasDec, &systemTimeInc_ms ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError getting render frame size in samples\n" );
        return error;
    }
    if ( ( error = IVAS_DEC_GetRenderFramesizeSamples( hIvasDec, &nOutSamples ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError getting render frame size in samples\n" );
@@ -3118,10 +3080,6 @@ static ivas_error decodeVoIP(
     * Main receiving/decoding loop
     *------------------------------------------------------------------------------------------*/

#ifdef DEBUG_JBM_CMD_OPTION
    systemTimeInc_ms = arg.frontendFetchSizeMs;
#endif

    while ( 1 )
    {
#ifndef NONBE_UNIFIED_DECODING_PATHS
@@ -3130,12 +3088,8 @@ static ivas_error decodeVoIP(
#else
        int16_t nOutSamples = 0;
#endif
#ifdef DEBUG_JBM_CMD_OPTION
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * arg.frontendFetchSizeMs );
#else
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * JBM_FRONTEND_FETCH_FRAMESIZE_MS );
#endif
#endif

#ifdef NONBE_UNIFIED_DECODING_PATHS
        /* reference vector */
@@ -3383,11 +3337,7 @@ static ivas_error decodeVoIP(
                    goto cleanup;
                }
            }
#ifdef DEBUG_JBM_CMD_OPTION
            else if ( arg.noBadFrameDelay == false )
#else
            else
#endif
            {
                ++numInitialBadFrames;
            }
+81 −0
Original line number Diff line number Diff line
@@ -187,7 +187,11 @@ typedef struct
    bool lfeCustomRoutingEnabled;
    char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH];
    float syncMdDelay;
#ifdef REMOVE_5MS_FLAG
    IVAS_RENDER_FRAMESIZE render_framesize;
#else
    bool framing_5ms;
#endif
    uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS];
    uint16_t acousticEnvironmentId;
} CmdlnArgs;
@@ -219,6 +223,9 @@ typedef enum
#endif
    CmdLnOptionId_referenceVectorFile,
    CmdLnOptionId_exteriorOrientationFile,
#ifdef REMOVE_5MS_FLAG
    CmdLnOptionId_framing,
#endif
    CmdLnOptionId_framing5ms,
    CmdLnOptionId_syncMdDelay,
    CmdLnOptionId_directivityPatternId,
@@ -368,6 +375,14 @@ static const CmdLnParser_Option cliOptions[] = {
        .matchShort = "exof",
        .description = "External orientation trajectory file for simulation of external orientations",
    },
#ifdef REMOVE_5MS_FLAG
    {
        .id = CmdLnOptionId_framing,
        .match = "framing",
        .matchShort = "fr",
        .description = "Set Render audio framing.",
    },
#endif
    {
        .id = CmdLnOptionId_framing5ms,
        .match = "framing_5ms",
@@ -1001,9 +1016,17 @@ int main(
#ifdef SPLIT_REND_WITH_HEAD_ROT
    }
#endif
#ifdef REMOVE_5MS_FLAG
    const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) );
#else
    const int16_t frameSize_smpls = (int16_t) ( ( args.framing_5ms ? 5 : 20 ) * args.sampleRate / 1000 );
#endif

#ifdef REMOVE_5MS_FLAG
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain, ( args.framing_5ms ) ? 1 : 4 ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) );
        exit( -1 );
@@ -1498,7 +1521,11 @@ int main(
    {
        int16_t num_in_channels;
        num_in_channels = inBuffer.config.numChannels;
#ifdef REMOVE_5MS_FLAG
        const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_framesize ) == 0;
#else
        const bool isCurrentFrameMultipleOf20ms = !args.framing_5ms || frame % 4 == 0;
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
        numSamplesRead = 0;
@@ -1550,7 +1577,11 @@ int main(
#endif

        int16_t num_subframes, sf_idx;
#ifdef REMOVE_5MS_FLAG
        num_subframes = (int16_t) args.render_framesize;
#else
        num_subframes = ( args.framing_5ms ) ? 1 : IVAS_MAX_PARAM_SPATIAL_SUBFRAMES;
#endif

        if ( isCurrentFrameMultipleOf20ms )
        {
@@ -2338,6 +2369,37 @@ static bool parseDiegeticPan(
    return true;
}


#ifdef REMOVE_5MS_FLAG
static bool parseRenderFramesize( char *value,
                                  IVAS_RENDER_FRAMESIZE *render_framesize )
{
    int32_t tmp;

    *render_framesize = IVAS_RENDER_FRAMESIZE_UNKNOWN;
    if ( !is_digits_only( value ) )
    {
        return false;
    }
    tmp = (int32_t) strtol( value, NULL, 0 );
    switch ( (int16_t) tmp )
    {
        case 5:
            *render_framesize = IVAS_RENDER_FRAMESIZE_5MS;
            break;
        case 10:
            *render_framesize = IVAS_RENDER_FRAMESIZE_10MS;
            break;
        case 20:
            *render_framesize = IVAS_RENDER_FRAMESIZE_20MS;
            break;
        default:
            return false;
    }
    return true;
}
#endif

static bool parseOrientationTracking(
    char *value,
    int8_t *orientation_tracking )
@@ -2635,7 +2697,11 @@ static CmdlnArgs defaultArgs(

    args.lfeCustomRoutingEnabled = false;
    clearString( args.inLfePanningMatrixFile );
#ifdef REMOVE_5MS_FLAG
    args.render_framesize = IVAS_RENDER_FRAMESIZE_20MS;
#else
    args.framing_5ms = false;
#endif
    args.syncMdDelay = 0;

    for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
@@ -2801,9 +2867,24 @@ static void parseOption(
                exit( -1 );
            }
            break;
#ifdef REMOVE_5MS_FLAG
        case CmdLnOptionId_framing:
            assert( numOptionValues == 1 );
            if ( !parseRenderFramesize( optionValues[0], &args->render_framesize ) )
            {
                fprintf( stderr, "Unknown or invalid option for LFE position: %s\n", optionValues[0] );
                exit( -1 );
            }

            break;
#endif
        case CmdLnOptionId_framing5ms:
            assert( numOptionValues == 0 );
#ifdef REMOVE_5MS_FLAG
            args->render_framesize = IVAS_RENDER_FRAMESIZE_5MS;
#else
            args->framing_5ms = true;
#endif
            fprintf( stderr, "Warning: this is a placeholder for 5ms framing.\n" );
            break;
        case CmdLnOptionId_directivityPatternId:
+5 −5
Original line number Diff line number Diff line
@@ -200,11 +200,11 @@ typedef enum
#ifdef REMOVE_5MS_FLAG
typedef enum
{
    RENDER_FRAMESIZE_UNKNOWN = 0,
    RENDER_FRAMESIZE_5MS = 1,
    RENDER_FRAMESIZE_10MS = 2,
    RENDER_FRAMESIZE_20MS = 4
} RENDER_FRAMESIZE;
    IVAS_RENDER_FRAMESIZE_UNKNOWN = 0,
    IVAS_RENDER_FRAMESIZE_5MS = 1,
    IVAS_RENDER_FRAMESIZE_10MS = 2,
    IVAS_RENDER_FRAMESIZE_20MS = 4
} IVAS_RENDER_FRAMESIZE;
#endif

typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
+5 −5
Original line number Diff line number Diff line
@@ -1076,11 +1076,6 @@ ivas_error ivas_dec(
        }
    }

#ifdef NONBE_UNIFIED_DECODING_PATHS
    /* update global combined orientation start index */
    ivas_combined_orientation_update_start_index( st_ivas->hCombinedOrientationData, output_frame );
#endif

    /*----------------------------------------------------------------*
     * Write IVAS output channels
     *   - compensation for saturation
@@ -1156,6 +1151,11 @@ ivas_error ivas_dec(

    st_ivas->last_ivas_format = st_ivas->ivas_format;

#ifdef NONBE_UNIFIED_DECODING_PATHS
    /* update global combined orientation start index */
    ivas_combined_orientation_update_start_index( st_ivas->hCombinedOrientationData, output_frame );
#endif

    /* in case first frame(s) was/were lost, deallocate output buffers */
    if ( st_ivas->bfi && st_ivas->ini_frame == 0 )
    {
+1 −1
Original line number Diff line number Diff line
@@ -260,7 +260,7 @@ static ivas_error ivas_dec_init_split_rend(
#endif

#ifdef REMOVE_5MS_FLAG
    error = ivas_split_renderer_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, st_ivas->hDecoderConfig->render_framesize == RENDER_FRAMESIZE_5MS );
    error = ivas_split_renderer_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, st_ivas->hDecoderConfig->render_framesize == IVAS_RENDER_FRAMESIZE_5MS );
#else
    error = ivas_split_renderer_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, st_ivas->hDecoderConfig->Opt_5ms );
#endif
Loading