Commit a9f0c978 authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into 749-splt_rendering-public-structure

parents bd6ce3b5 858b25b9
Loading
Loading
Loading
Loading
+28 −39
Original line number Diff line number Diff line
@@ -145,10 +145,9 @@ typedef struct
#endif
#endif
    uint16_t acousticEnvironmentId;
#ifdef FIX_708_DPID_COMMAND_LINE
    int16_t Opt_dpid_on;
#endif
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];

} DecArguments;


@@ -197,7 +196,11 @@ int main(
    RotFileReader *refRotReader = NULL;
    Vector3PairFileReader *referenceVectorReader = NULL;
    ivas_error error = IVAS_ERR_UNKNOWN;
#ifdef FIX_847_OUTPUT_PCM_BUFFER
    int16_t *pcmBuf = NULL;
#else
    int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE];
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
    uint8_t splitRendBitsBuf[IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES];
#endif
@@ -434,13 +437,8 @@ int main(
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/

    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.enable5ms,
                                       arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain,
#ifdef FIX_708_DPID_COMMAND_LINE
                                       arg.Opt_dpid_on,
#endif
                                       arg.acousticEnvironmentId,
                                       arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.enable5ms, 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, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -638,11 +636,7 @@ int main(

        if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK )
        {
#ifdef NONBE_FIX_730_DPID_NOT_SET_CORRECTLY
            fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] );
#else
            fprintf( stderr, "Failed to get directivity for objects: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] );
#endif
            goto cleanup;
        }

@@ -753,6 +747,21 @@ int main(
        }
    }

#ifdef FIX_847_OUTPUT_PCM_BUFFER
    /*------------------------------------------------------------------------------------------*
     * Allocate output data buffer
     *------------------------------------------------------------------------------------------*/

    int16_t pcmBufSize;
    if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmBufSize ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nGetOutputBufferSize failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }

    pcmBuf = malloc( pcmBufSize * sizeof( int16_t ) );

#endif

    /*-----------------------------------------------------------------*
     * Decoding
@@ -807,10 +816,14 @@ int main(

cleanup:

#ifdef FIX_847_OUTPUT_PCM_BUFFER
    free( pcmBuf );
#endif

#ifdef DEBUG_SBA_AUDIO_DUMP
    IVAS_DEC_GetSbaDebugParams( hIvasDec, &numOutChannels, &numTransportChannels, &pca_ingest_channels );
#endif

#endif
    if ( arg.hrtfReaderEnabled )
    {
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;
@@ -1002,9 +1015,7 @@ static bool parseCmdlIVAS_dec(

    arg->renderConfigEnabled = false;
    arg->renderConfigFilename = NULL;
#ifdef FIX_708_DPID_COMMAND_LINE
    arg->Opt_dpid_on = 0;
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
    arg->outputMdFilename = NULL;
@@ -1031,11 +1042,7 @@ static bool parseCmdlIVAS_dec(
    arg->acousticEnvironmentId = 65535;
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
#ifdef NONBE_FIX_730_DPID_NOT_SET_CORRECTLY
        arg->directivityPatternId[i] = 65535;
#else
        arg->directivityPatternId[i] = 0;
#endif
    }

    /*-----------------------------------------------------------------*
@@ -1424,17 +1431,13 @@ static bool parseCmdlIVAS_dec(
        }
        else if ( strcmp( argv_to_upper, "-DPID" ) == 0 )
        {
#ifdef FIX_708_DPID_COMMAND_LINE
            int16_t id;
            int16_t id, tmp;

            arg->Opt_dpid_on = 1;
#endif
            ++i;
            int16_t tmp;
            tmp = 0;
            while ( is_number( argv[i + tmp] ) && tmp < IVAS_MAX_NUM_OBJECTS )
            {
#ifdef FIX_708_DPID_COMMAND_LINE
                id = (int16_t) atoi( argv[i + tmp] );

                if ( !is_digits_only( argv[i + tmp] ) || id < 0 )
@@ -1445,13 +1448,9 @@ static bool parseCmdlIVAS_dec(
                }

                arg->directivityPatternId[tmp] = id;
#else
                arg->directivityPatternId[tmp] = (int16_t) atoi( argv[i + tmp] );
#endif
                ++tmp;
            }

#ifdef FIX_708_DPID_COMMAND_LINE
            if ( tmp == 0 )
            {
                if ( argc - i <= 4 || argv[i][0] == '-' )
@@ -1468,7 +1467,6 @@ static bool parseCmdlIVAS_dec(
                    return false;
                }
            }
#endif

            i += tmp;
        }
@@ -1564,12 +1562,7 @@ static bool parseCmdlIVAS_dec(
        return false;
    }

#ifdef FIX_807_VARIABLE_SPEED_DECODING
    if ( ( !arg->enableHeadRotation ) && ( !arg->enableExternalOrientation ) && ( !arg->tsmEnabled ) )
#else
    if ( ( !arg->enableHeadRotation ) && ( !arg->enableExternalOrientation ) )
#endif

    {
        arg->enable5ms = false;
    }
@@ -1663,15 +1656,11 @@ static void usage_dec( void )
    fprintf( stdout, "-force R            : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" );
#endif
    fprintf( stdout, "-exof File          : External orientation File for external orientation trajectory\n" );
#ifdef FIX_708_DPID_COMMAND_LINE
    fprintf( stdout, "-dpid ID            : Directivity pattern ID(s) = [ID1, ID2, ID3, ID4]. Space-separated list of up\n" );
    fprintf( stdout, "                      to 4 numbers (unsigned integers) can be specified for BINAURAL and BINAURAL_ROOM_REVERB\n" );
    fprintf( stdout, "                      output configuration. ID1, ID2, ID3, ID4 specify the directivity pattern IDs used for\n" );
    fprintf( stdout, "                      ISMs 1,2,3 and 4 respectively. This options needs to be accompanied by a render_config file,\n" );
    fprintf( stdout, "                      otherwise a default directivity pattern is used.\n" );
#else
    fprintf( stdout, "-dpid ID            : Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration\n" );
#endif
    fprintf( stdout, "-aeid ID            : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" );
    fprintf( stdout, "-level level        : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" );
    fprintf( stdout, "                      Currently, all values default to level 3 (full functionality).\n" );
+0 −8
Original line number Diff line number Diff line
@@ -384,11 +384,7 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_directivityPatternId,
        .match = "ism_directivity_pattern_id",
        .matchShort = "dpid",
#ifdef FIX_708_DPID_COMMAND_LINE
        .description = "Directivity pattern ID(s) = [ID1, ID2, ID3, ID4]. Space-separated list of up to 4 numbers (unsigned integers) can be specified for BINAURAL and BINAURAL_ROOM_REVERB output configuration.\nID1, ID2, ID3, ID4 specify the directivity pattern IDs used for ISMs 1,2,3 and 4 respectively.\nThis options needs to be accompanied by a render_config file, otherwise a default directivity pattern is used.",
#else
        .description = "Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration",
#endif
    },
    {
        .id = CmdLnOptionId_acousticEnvironmentId,
@@ -2640,11 +2636,7 @@ static CmdlnArgs defaultArgs(

    for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
    {
#ifdef NONBE_FIX_730_DPID_NOT_SET_CORRECTLY
        args.directivityPatternId[i] = 65535;
#else
        args.directivityPatternId[i] = 0;
#endif
    }

    args.acousticEnvironmentId = 65535;
+7 −4
Original line number Diff line number Diff line
@@ -65,6 +65,9 @@ typedef enum
    IVAS_ERR_INVALID_FEC_CONFIG,
    IVAS_ERR_INVALID_FEC_OFFSET,
    IVAS_ERR_INVALID_INPUT_BUFFER_SIZE,
#ifdef FIX_847_OUTPUT_PCM_BUFFER
    IVAS_ERR_INVALID_OUTPUT_BUFFER_SIZE,
#endif
    IVAS_ERR_DTX_NOT_SUPPORTED,
    IVAS_ERR_UNEXPECTED_NULL_POINTER,
    IVAS_ERR_METADATA_NOT_EXPECTED,
@@ -75,9 +78,7 @@ typedef enum
    IVAS_ERR_INVALID_OUTPUT_FORMAT,
    IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED,
    IVAS_ERR_EXT_ORIENTATION_NOT_SUPPORTED,
#ifdef FIX_708_DPID_COMMAND_LINE
    IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED,
#endif
    IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED,
    IVAS_ERR_INVALID_HRTF,
    IVAS_ERR_INVALID_INPUT_FORMAT,
@@ -219,6 +220,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code )
            return "Invalid FEC offset";
        case IVAS_ERR_INVALID_INPUT_BUFFER_SIZE:
            return "Invalid input buffer size";
#ifdef FIX_847_OUTPUT_PCM_BUFFER
        case IVAS_ERR_INVALID_OUTPUT_BUFFER_SIZE:
            return "Invalid output buffer size";
#endif
        case IVAS_ERR_DTX_NOT_SUPPORTED:
            return "DTX is not supported in this IVAS format and element mode";
        case IVAS_ERR_UNEXPECTED_NULL_POINTER:
@@ -253,10 +258,8 @@ static inline const char *ivas_error_to_string( ivas_error error_code )
#endif
        case IVAS_ERR_EXT_ORIENTATION_NOT_SUPPORTED:
            return "External orientation not supported";
#ifdef FIX_708_DPID_COMMAND_LINE
        case IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED:
            return "Directivity not supported";
#endif
        case IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED:
            return "Acoustic environment not supported";
        case IVAS_ERR_INVALID_HRTF:
+10 −50
Original line number Diff line number Diff line
@@ -727,21 +727,13 @@ void ivas_fb_mixer_process(

void ivas_fb_mixer_get_in_out_mapping(
    const IVAS_FB_CFG *fb_cfg,                                                       /* i  : FB config. handle  */
#ifndef REMOVE_UNUSED_FUNCTION
    const int16_t nchan_transport, /* i  : number of transport channels                  */
    const int16_t enc_dec_flag,    /* i  : encoder or decoder flag                       */
    const int16_t *order,          /* i  : downmix order                                 */
#endif
    int16_t in_out_mixer_map[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i/o: mixing mapping     */
)
{
    int16_t i, j;

    set_s( (int16_t *) in_out_mixer_map, 0, IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH );
#ifndef REMOVE_UNUSED_FUNCTION
    if ( enc_dec_flag == ENC )
    {
#endif

    if ( fb_cfg->active_w_mixing )
    {
        for ( i = 0; i < fb_cfg->num_out_chans; i++ )
@@ -760,39 +752,7 @@ void ivas_fb_mixer_get_in_out_mapping(
            in_out_mixer_map[i][0] = 1;
        }
    }
#ifndef REMOVE_UNUSED_FUNCTION
    }
    else
    {
        in_out_mixer_map[0][0] = 1; /* W depends on only W input*/
        for ( i = 1; i < nchan_transport; i++ )
        {
            in_out_mixer_map[order[i]][0] = 1;
            in_out_mixer_map[order[i]][i] = 1;
        }
        if ( nchan_transport == 1 )
        {
            /* no cross predicitons in 1 ch dmx*/
            for ( i = nchan_transport; i < fb_cfg->num_out_chans; i++ )
            {
                in_out_mixer_map[order[i]][0] = 1;
                in_out_mixer_map[order[i]][i] = 1;
            }
        }
        else
        {
            /* handle the cross predictions and decorrelation*/
            for ( i = nchan_transport; i < fb_cfg->num_out_chans; i++ )
            {
                for ( j = 0; j < nchan_transport; j++ )
                {
                    in_out_mixer_map[order[i]][j] = 1;
                }
                in_out_mixer_map[order[i]][i] = 1;
            }
        }
    }
#endif

    return;
}

+9 −14
Original line number Diff line number Diff line
@@ -110,12 +110,7 @@ ivas_error mct_enc_reconfigure(
ivas_error ivas_sba_enc_reconfigure(
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                  */
);
#ifndef REMOVE_UNUSED_FUNCTION
/*! r: maximum SBA metadata bit-budget */
int16_t ivas_sba_get_max_md_bits(
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                  */
);
#endif

void destroy_sce_enc(
    SCE_ENC_HANDLE hSCE                                         /* i/o: SCE encoder structure                   */
);
@@ -299,6 +294,14 @@ ivas_error ivas_init_decoder(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);

#ifdef NONBE_FIX_839_MC_RS_CHANNEL_ALLOC
ivas_error ivas_output_buff_dec(
    float *p_output_f[],                                        /* i/o: output audio buffers                    */
    const int16_t nchan_out_buff_old,                           /* i  : previous frame number of output channels*/
    const int16_t nchan_out_buff                                /* i  : number of output channels               */   
);
#endif

ivas_error stereo_dmx_evs_init_encoder(
    STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS,                   /* o  : Stereo downmix for EVS encoder handle   */
    const int32_t input_Fs                                      /* i  : input sampling rate                     */
@@ -4164,9 +4167,6 @@ ivas_error ivas_sba_linear_renderer(
	const int16_t nchan_ism,
    const AUDIO_CONFIG output_config,                           /* i  : output audio configuration                              */
    const IVAS_OUTPUT_SETUP output_setup                        /* i  : output format setup                                     */
#ifndef REMOVE_UNUSED_FUNCTION
    ,const float hoa_dec_mtx[]                                   /* i  : HOA decoding mtx                                        */
#endif
);

void ivas_sba_mix_matrix_determiner(
@@ -6036,11 +6036,6 @@ void ivas_fb_mixer_process(

void ivas_fb_mixer_get_in_out_mapping(
    const IVAS_FB_CFG *fb_cfg,                                  /* i  : FB config. handle                           */
#ifndef REMOVE_UNUSED_FUNCTION
    const int16_t nchan_transport,                              /* i  : number of transport channels                */
    const int16_t enc_dec_flag,                                 /* i  : encoder or decoder flag                     */
    const int16_t *order,                                       /* i  : downmix order                               */
#endif
    int16_t in_out_mixer_map[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH]   /* i/o: mixing mapping       */
);

Loading