Commit e143622a authored by vaclav's avatar vaclav
Browse files

fix use of "renderFramesize" vs. "render_num_subframes"

parent 27548c81
Loading
Loading
Loading
Loading
Loading
+19 −18
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ typedef struct
    char *outputMdFilename;
    IVAS_DEC_COMPLEXITY_LEVEL complexityLevel;
    bool tsmEnabled;
    IVAS_RENDER_FRAMESIZE renderFramesize;
    IVAS_RENDER_NUM_SUBFR render_num_subframes;
#ifdef DEBUGGING
    IVAS_DEC_FORCED_REND_MODE forcedRendMode;
#ifdef DEBUG_FOA_AGC
@@ -196,7 +196,7 @@ int main(
    Vector3PairFileReader *referenceVectorReader = NULL;
    RenderConfigReader *renderConfigReader = NULL;
    int16_t *pcmBuf = NULL;
    IVAS_RENDER_FRAMESIZE asked_frame_size;
    IVAS_RENDER_NUM_SUBFR asked_num_subframes;
    IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
    IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL;
    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL;
@@ -425,21 +425,23 @@ int main(
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/

    asked_frame_size = arg.renderFramesize;
    asked_num_subframes = arg.render_num_subframes;
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;
    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.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain,

    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.render_num_subframes, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain,
                                       arg.Opt_dpid_on, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }
    if ( ( error = IVAS_DEC_GetRenderFramesize( hIvasDec, &arg.renderFramesize ) ) != IVAS_ERR_OK )

    if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &arg.render_num_subframes ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }

    if ( arg.renderFramesize != asked_frame_size )
    if ( arg.render_num_subframes != asked_num_subframes )
    {
        fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for decoding to EXT!\n" );
    }
@@ -448,7 +450,6 @@ int main(
     * Configure Split rendering
     *------------------------------------------------------------------------------------------*/

    asked_frame_size = arg.renderFramesize;
    if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK )
@@ -457,7 +458,7 @@ int main(
            goto cleanup;
        }

        if ( ( error = IVAS_DEC_GetRenderFramesize( hIvasDec, &arg.renderFramesize ) ) != IVAS_ERR_OK )
        if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &arg.render_num_subframes ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
@@ -625,23 +626,23 @@ int main(
        }
        if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
        {
            if ( asked_frame_size != IVAS_RENDER_FRAMESIZE_20MS &&
            if ( asked_num_subframes != IVAS_RENDER_NUM_SUBFR_20MS &&
                 ( renderConfig.split_rend_config.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
                   renderConfig.split_rend_config.dof == 0 ) )
            {
                arg.renderFramesize = asked_frame_size;
                arg.render_num_subframes = asked_num_subframes;
            }
            else
            {
                arg.renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
                arg.render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS;
            }

            if ( ( error = IVAS_DEC_SetRenderFramesize( hIvasDec, arg.renderFramesize ) ) != IVAS_ERR_OK )
            if ( ( error = IVAS_DEC_SetRenderFramesize( hIvasDec, arg.render_num_subframes ) ) != IVAS_ERR_OK )
            {
                return error;
            }

            if ( arg.renderFramesize != asked_frame_size )
            if ( arg.render_num_subframes != asked_num_subframes )
            {
                fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for non-0dof split rendering!\n" );
            }
@@ -667,7 +668,7 @@ int main(

        /* ISAR frame size is set from command line, not renderer config file.
         * This will be ignored if output format is not split rendering. */
        renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) arg.renderFramesize /* given in number of 5ms subframes */ * 5;
        renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) arg.render_num_subframes * 5;

        if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK )
        {
@@ -1074,7 +1075,7 @@ static bool parseCmdlIVAS_dec(
    arg->Opt_non_diegetic_pan = 0;
    arg->non_diegetic_pan_gain = 0.f;
    arg->tsmEnabled = false;
    arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
    arg->render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS;
#ifdef DEBUGGING
#ifdef VARIABLE_SPEED_DECODING
    arg->tsmScale = 100;
@@ -1288,13 +1289,13 @@ static bool parseCmdlIVAS_dec(
                switch ( (int16_t) tmp )
                {
                    case 5:
                        arg->renderFramesize = IVAS_RENDER_FRAMESIZE_5MS;
                        arg->render_num_subframes = IVAS_RENDER_NUM_SUBFR_5MS;
                        break;
                    case 10:
                        arg->renderFramesize = IVAS_RENDER_FRAMESIZE_10MS;
                        arg->render_num_subframes = IVAS_RENDER_NUM_SUBFR_10MS;
                        break;
                    case 20:
                        arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
                        arg->render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS;
                        break;
                    default:
                        fprintf( stderr, "Error: Invalid render frame size %d \n\n", tmp );
+13 −11
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ typedef struct
    bool delayCompensationEnabled;
    bool quietModeEnabled;
    bool sceneDescriptionInput;
    IVAS_RENDER_FRAMESIZE render_framesize;
    IVAS_RENDER_NUM_SUBFR render_num_subframes;
} CmdlnArgs;

typedef enum
@@ -328,26 +328,28 @@ static bool parseInConfig(

static bool parseRenderFramesize(
    char *value,
    IVAS_RENDER_FRAMESIZE *render_framesize )
    IVAS_RENDER_NUM_SUBFR *render_num_subframes )
{
    int32_t tmp;

    *render_framesize = IVAS_RENDER_FRAMESIZE_UNKNOWN;
    *render_num_subframes = IVAS_RENDER_NUM_SUBFR_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;
            *render_num_subframes = IVAS_RENDER_NUM_SUBFR_5MS;
            break;
        case 10:
            *render_framesize = IVAS_RENDER_FRAMESIZE_10MS;
            *render_num_subframes = IVAS_RENDER_NUM_SUBFR_10MS;
            break;
        case 20:
            *render_framesize = IVAS_RENDER_FRAMESIZE_20MS;
            *render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS;
            break;
        default:
            return false;
@@ -452,7 +454,7 @@ static CmdlnArgs defaultArgs(
    args.quietModeEnabled = false;
    args.sceneDescriptionInput = false;

    args.render_framesize = IVAS_RENDER_FRAMESIZE_20MS;
    args.render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS;

    return args;
}
@@ -535,7 +537,7 @@ static void parseOption(
            break;
        case CmdLnOptionId_framing:
            assert( numOptionValues == 1 );
            if ( !parseRenderFramesize( optionValues[0], &args->render_framesize ) )
            if ( !parseRenderFramesize( optionValues[0], &args->render_num_subframes ) )
            {
                fprintf( stderr, "Unknown or invalid option for frame size: %s\n", optionValues[0] );
                exit( -1 );
@@ -859,9 +861,9 @@ int main(
     * Open ISAR handle
     *------------------------------------------------------------------------------------------*/

    const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) );
    const int16_t frameSize_smpls = (int16_t) ( ( args.render_num_subframes ) * args.sampleRate * 5 / ( 1000 ) );
    args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_BINAURAL;
    if ( ( error = ISAR_POST_REND_open( &hIsarPostRend, args.sampleRate, args.outConfig.audioConfig, true, 0, 0.0, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK )
    if ( ( error = ISAR_POST_REND_open( &hIsarPostRend, args.sampleRate, args.outConfig.audioConfig, true, 0, 0.0, (int16_t) args.render_num_subframes ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) );
        exit( -1 );
@@ -1028,7 +1030,7 @@ int main(
        convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, num_in_channels, inFloatBuffer );

        int16_t num_subframes, sf_idx;
        num_subframes = (int16_t) args.render_framesize;
        num_subframes = (int16_t) args.render_num_subframes;

        /* Read from head rotation trajectory file if specified */
        if ( headRotReader != NULL )
+14 −13
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ typedef struct
    bool lfeCustomRoutingEnabled;
    char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH];
    float syncMdDelay;
    IVAS_RENDER_FRAMESIZE render_framesize;
    IVAS_RENDER_NUM_SUBFR render_num_subframes;
    uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS];
    AcousticEnvironmentSequence aeSequence;
} CmdlnArgs;
@@ -880,9 +880,9 @@ int main(
        exit( -1 );
    }

    const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) );
    const int16_t frameSize_smpls = (int16_t) ( ( args.render_num_subframes ) * args.sampleRate * 5 / ( 1000 ) );

    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK )
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_num_subframes ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) );
        exit( -1 );
@@ -1047,7 +1047,7 @@ int main(

        /* ISAR frame size is set from command line, not renderer config file.
         * This will be ignored if output format is not split rendering. */
        renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) args.render_framesize /* given in number of 5ms subframes */ * 5;
        renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) args.render_num_subframes * 5;

        if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK )
        {
@@ -1424,7 +1424,7 @@ int main(
    {
        int16_t num_in_channels;
        num_in_channels = inBuffer.config.numChannels;
        const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_framesize ) == 0;
        const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_num_subframes ) == 0;

        if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL &&
             args.aeSequence.count > 0 && args.aeSequence.pValidity[args.aeSequence.selected] != 0 )
@@ -1475,7 +1475,7 @@ int main(
        convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, num_in_channels, inFloatBuffer, inBuffer.config.is_cldfb, cldfbAna );

        int16_t num_subframes, sf_idx;
        num_subframes = (int16_t) args.render_framesize;
        num_subframes = (int16_t) args.render_num_subframes;

        if ( isCurrentFrameMultipleOf20ms )
        {
@@ -2176,26 +2176,27 @@ static bool parseDiegeticPan(

static bool parseRenderFramesize(
    char *value,
    IVAS_RENDER_FRAMESIZE *render_framesize )
    IVAS_RENDER_NUM_SUBFR *render_num_subframes )
{
    int32_t tmp;

    *render_framesize = IVAS_RENDER_FRAMESIZE_UNKNOWN;
    *render_num_subframes = IVAS_RENDER_NUM_SUBFR_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;
            *render_num_subframes = IVAS_RENDER_NUM_SUBFR_5MS;
            break;
        case 10:
            *render_framesize = IVAS_RENDER_FRAMESIZE_10MS;
            *render_num_subframes = IVAS_RENDER_NUM_SUBFR_10MS;
            break;
        case 20:
            *render_framesize = IVAS_RENDER_FRAMESIZE_20MS;
            *render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS;
            break;
        default:
            return false;
@@ -2526,7 +2527,7 @@ static CmdlnArgs defaultArgs(

    args.lfeCustomRoutingEnabled = false;
    clearString( args.inLfePanningMatrixFile );
    args.render_framesize = IVAS_RENDER_FRAMESIZE_20MS;
    args.render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS;
    args.syncMdDelay = 0;

    for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
@@ -2692,7 +2693,7 @@ static void parseOption(
            break;
        case CmdLnOptionId_framing:
            assert( numOptionValues == 1 );
            if ( !parseRenderFramesize( optionValues[0], &args->render_framesize ) )
            if ( !parseRenderFramesize( optionValues[0], &args->render_num_subframes ) )
            {
                fprintf( stderr, "Unknown or invalid option for frame size: %s\n", optionValues[0] );
                exit( -1 );
+5 −5
Original line number Diff line number Diff line
@@ -155,12 +155,12 @@ typedef enum

typedef enum
{
    IVAS_RENDER_FRAMESIZE_UNKNOWN = 0,
    IVAS_RENDER_FRAMESIZE_5MS = 1,
    IVAS_RENDER_FRAMESIZE_10MS = 2,
    IVAS_RENDER_FRAMESIZE_20MS = 4
    IVAS_RENDER_NUM_SUBFR_UNKNOWN = 0,
    IVAS_RENDER_NUM_SUBFR_5MS = 1,
    IVAS_RENDER_NUM_SUBFR_10MS = 2,
    IVAS_RENDER_NUM_SUBFR_20MS = 4

} IVAS_RENDER_FRAMESIZE;
} IVAS_RENDER_NUM_SUBFR;

typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE;
+2 −2
Original line number Diff line number Diff line
@@ -822,7 +822,7 @@ ivas_error ivas_init_decoder_front(

    if ( st_ivas->hDecoderConfig->Opt_ExternalOrientation )
    {
        if ( ( error = ivas_external_orientation_open( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_framesize ) ) != IVAS_ERR_OK )
        if ( ( error = ivas_external_orientation_open( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_num_subframes ) ) != IVAS_ERR_OK )
        {
            return error;
        }
@@ -834,7 +834,7 @@ ivas_error ivas_init_decoder_front(

    if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
    {
        if ( ( error = ivas_combined_orientation_open( &( st_ivas->hCombinedOrientationData ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->render_framesize ) ) != IVAS_ERR_OK )
        if ( ( error = ivas_combined_orientation_open( &( st_ivas->hCombinedOrientationData ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->render_num_subframes ) ) != IVAS_ERR_OK )
        {
            return error;
        }
Loading