Commit f9293108 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_350_MASA_DELAY_COMP

parent 476024dc
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -1353,24 +1353,15 @@ static ivas_error initOnFirstGoodFrame(
        /* If outputting MASA, open output file and write metadata for initial bad frames */
        else if ( *pBsFormat == IVAS_DEC_BS_MASA )
        {
#ifdef FIX_350_MASA_DELAY_COMP
            if ( ( error = MasaFileWriter_open( arg.outputWavFilename, arg.delayCompensationEnabled, ppMasaWriter ) ) != IVAS_ERR_OK )
#else
            if ( ( error = MasaFileWriter_open( arg.outputWavFilename, ppMasaWriter ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nError: Error opening MASA decoded metadata file %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) );
                return error;
            }

            /* Duplicate good first frame metadata to fill the beginning of stream. */
#ifdef FIX_350_MASA_DELAY_COMP
            MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL;
            if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#else
            IVAS_MASA_QMETADATA_HANDLE qMetadata = NULL;
            if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &qMetadata ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                return error;
@@ -1378,11 +1369,7 @@ static ivas_error initOnFirstGoodFrame(

            for ( int16_t j = 0; j < numInitialBadFrames; ++j )
            {
#ifdef FIX_350_MASA_DELAY_COMP
                if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#else
                if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, qMetadata ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) );
                    return error;
@@ -1646,23 +1633,14 @@ static ivas_error decodeG192(
            }
            else if ( bsFormat == IVAS_DEC_BS_MASA )
            {
#ifdef FIX_350_MASA_DELAY_COMP
                MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#else
                IVAS_MASA_QMETADATA_HANDLE qMetadata;
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &qMetadata ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }

#ifdef FIX_350_MASA_DELAY_COMP
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#else
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, qMetadata ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
                    goto cleanup;
+0 −4
Original line number Diff line number Diff line
@@ -102,11 +102,7 @@ typedef struct
#endif

typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
#ifdef FIX_350_MASA_DELAY_COMP
typedef struct ivas_masa_decoder_ext_out_meta_struct *MASA_DECODER_EXT_OUT_META_HANDLE;
#else
typedef struct ivas_masa_qmetadata_frame_struct *IVAS_MASA_QMETADATA_HANDLE;
#endif

typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE;
typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE;
+0 −4
Original line number Diff line number Diff line
@@ -69,12 +69,10 @@ int32_t get_delay(
        {
            delay = IVAS_ENC_DELAY_NS;

#ifdef FIX_350_MASA_DELAY_COMP
            if ( ivas_format == MASA_FORMAT )
            {
                delay = 0; /* All delay is compensated in the decoder with MASA */
            }
#endif
        }

        if ( ivas_format == SBA_FORMAT )
@@ -107,12 +105,10 @@ int32_t get_delay(
            }


#ifdef FIX_350_MASA_DELAY_COMP
            if ( ivas_format == MASA_FORMAT )
            {
                delay += IVAS_ENC_DELAY_NS; /* Compensate also the encoder delay in the decoder with MASA */
            }
#endif
        }
    }

+0 −5
Original line number Diff line number Diff line
@@ -961,10 +961,8 @@ typedef enum
#define DELAY_DIRAC_SPAR_ENC_CMP_NS             500000L                    /* here we may set the 24 samples (at 48 kHz) additional delay to something else, leave as is for now*/       
#define DELAY_DIRAC_PARAM_DEC_SFR               2                           /* Delay to be compensation for DirAC parameters in the decoder (subframes) */

#ifdef FIX_350_MASA_DELAY_COMP
#define DELAY_MASA_PARAM_DEC_SFR                2                           /* Delay to be compensation for MASA parameters in the decoder (subframes) */
#define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 )                        /* Spherical index corresponding to front direction for setting as default value */
#endif

#define DIRAC_SLOT_NS                           1250000L                    /* time duration of a time slot, 1.25ms (==DELAY_RENERER_NS/MAX_PARAM_SPATIAL_SUBFRAMES) */
#define DIRAC_SLOT_ENC_NS                       5000000L
@@ -1136,9 +1134,6 @@ enum
#define MASA_MAXIMUM_DIRECTIONS                 2
#define MASA_MAX_TRANSPORT_CHANNELS             2

#ifndef FIX_350_MASA_DELAY_COMP
#define MASA_ENC_DELAY_SLOTS                    7
#endif

#define MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS   5

+0 −4
Original line number Diff line number Diff line
@@ -314,10 +314,8 @@ void masa_sample_rate_band_correction(
    int16_t *band_mapping,            /* i/o: Band mapping used and modified        */
    IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification  */
    const int32_t sampling_rate       /* i  : Sampling rate                         */
#ifdef FIX_350_MASA_DELAY_COMP
    ,
    MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */
#endif
)
{
    uint8_t band, sf;
@@ -390,7 +388,6 @@ void masa_sample_rate_band_correction(
            hQMetaData->twoDirBands[band] = 0;
        }
    }
#ifdef FIX_350_MASA_DELAY_COMP
    if ( hExtOutMeta != NULL )
    {
        /* in decoder, zero the EXT out MASA meta buffer */
@@ -411,7 +408,6 @@ void masa_sample_rate_band_correction(
            }
        }
    }
#endif

    return;
}
Loading