Commit 0bdd149a authored by multrus's avatar multrus
Browse files

[cleanup] accept MASA_AND_OBJECTS

parent 0367e247
Loading
Loading
Loading
Loading
+0 −48
Original line number Diff line number Diff line
@@ -1789,16 +1789,12 @@ static ivas_error initOnFirstGoodFrame(
            return error;
        }
        /* If outputting ISM, get number of objects, open output files and write zero metadata for initial bad frames */
#ifdef MASA_AND_OBJECTS
        if ( *pBsFormat == IVAS_DEC_BS_OBJ || *pBsFormat == IVAS_DEC_BS_MASA_ISM
#ifdef SBA_AND_OBJECTS

             || *pBsFormat == IVAS_DEC_BS_SBA_ISM
#endif
        )
#else
        if ( *pBsFormat == IVAS_DEC_BS_OBJ )
#endif
        {
            if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, pNumObj ) ) != IVAS_ERR_OK )
            {
@@ -1838,11 +1834,7 @@ static ivas_error initOnFirstGoodFrame(
        }

        /* If outputting MASA, open output file and write metadata for initial bad frames */
#ifdef MASA_AND_OBJECTS
        if ( *pBsFormat == IVAS_DEC_BS_MASA || *pBsFormat == IVAS_DEC_BS_MASA_ISM )
#else
        else if ( *pBsFormat == IVAS_DEC_BS_MASA )
#endif
        {
            if ( ( error = MasaFileWriter_open( arg.outputWavFilename, arg.delayCompensationEnabled, ppMasaWriter ) ) != IVAS_ERR_OK )
            {
@@ -1850,10 +1842,8 @@ static ivas_error initOnFirstGoodFrame(
                return error;
            }

#ifdef MASA_AND_OBJECTS
            if ( numInitialBadFrames > 0 )
            {
#endif
                /* Duplicate good first frame metadata to fill the beginning of stream. */
                MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL;
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
@@ -1870,9 +1860,7 @@ static ivas_error initOnFirstGoodFrame(
                        return error;
                    }
                }
#ifdef MASA_AND_OBJECTS
            }
#endif
        }
    }

@@ -2181,15 +2169,11 @@ static ivas_error decodeG192(
        /* Write MASA/ISM metadata to external file(s) */
        if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL )
        {
#ifdef MASA_AND_OBJECTS
            if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM
#ifdef SBA_AND_OBJECTS
                 || bsFormat == IVAS_DEC_BS_SBA_ISM
#endif
            )
#else
            if ( bsFormat == IVAS_DEC_BS_OBJ )
#endif
            {
                if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK )
                {
@@ -2214,12 +2198,8 @@ static ivas_error decodeG192(
                    }
                }
            }
#ifdef MASA_AND_OBJECTS

            if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
#else
            else if ( bsFormat == IVAS_DEC_BS_MASA )
#endif
            {
                MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
@@ -2302,7 +2282,6 @@ static ivas_error decodeG192(
        {
            fprintf( stdout, "\nOutput metadata file:   %s\n", MasaFileWriter_getFilePath( masaWriter ) );
        }
#ifdef MASA_AND_OBJECTS
        else if ( bsFormat == IVAS_DEC_BS_MASA_ISM )
        {
            for ( i = 0; i < numObj; i++ )
@@ -2311,7 +2290,6 @@ static ivas_error decodeG192(
            }
            fprintf( stdout, "\nOutput MASA metadata file:  %s\n", MasaFileWriter_getFilePath( masaWriter ) );
        }
#endif
    }

    /*------------------------------------------------------------------------------------------*
@@ -2780,11 +2758,7 @@ static ivas_error decodeVoIP(
            {
                int16_t i;

#ifdef MASA_AND_OBJECTS
                if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM )
#else
                if ( bsFormat == IVAS_DEC_BS_OBJ )
#endif
                {
                    if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK )
                    {
@@ -2809,12 +2783,8 @@ static ivas_error decodeVoIP(
                        }
                    }
                }
#ifdef MASA_AND_OBJECTS

                if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
#else
                else if ( bsFormat == IVAS_DEC_BS_MASA )
#endif
                {
                    MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
                    if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 1 ) ) != IVAS_ERR_OK )
@@ -3218,11 +3188,7 @@ static ivas_error decodeVariableSpeed(
        /* Write ISm metadata to external file(s) */
        if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL )
        {
#ifdef MASA_AND_OBJECTS
            if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM )
#else
            if ( bsFormat == IVAS_DEC_BS_OBJ )
#endif
            {
                if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK )
                {
@@ -3247,12 +3213,8 @@ static ivas_error decodeVariableSpeed(
                    }
                }
            }
#ifdef MASA_AND_OBJECTS

            if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
#else
            else if ( bsFormat == IVAS_DEC_BS_MASA )
#endif
            {
                MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 1 ) ) != IVAS_ERR_OK )
@@ -3402,11 +3364,7 @@ static ivas_error decodeVariableSpeed(
        /* Write ISm metadata to external file(s) */
        if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL )
        {
#ifdef MASA_AND_OBJECTS
            if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM )
#else
            if ( bsFormat == IVAS_DEC_BS_OBJ )
#endif
            {
                if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK )
                {
@@ -3431,12 +3389,8 @@ static ivas_error decodeVariableSpeed(
                    }
                }
            }
#ifdef MASA_AND_OBJECTS

            if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
#else
            else if ( bsFormat == IVAS_DEC_BS_MASA )
#endif
            {
                MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
@@ -3496,7 +3450,6 @@ static ivas_error decodeVariableSpeed(
        {
            fprintf( stdout, "\nOutput metadata file:   %s\n", MasaFileWriter_getFilePath( masaWriter ) );
        }
#ifdef MASA_AND_OBJECTS
        else if ( bsFormat == IVAS_DEC_BS_MASA_ISM )
        {
            for ( i = 0; i < numObj; i++ )
@@ -3505,7 +3458,6 @@ static ivas_error decodeVariableSpeed(
            }
            fprintf( stdout, "\nOutput MASA metadata file:  %s\n", MasaFileWriter_getFilePath( masaWriter ) );
        }
#endif
    }

    /* add zeros at the end to have equal length of synthesized signals */
+0 −12
Original line number Diff line number Diff line
@@ -88,14 +88,12 @@ typedef union _EncInputFormatConfig
    /* MC details */
    IVAS_ENC_MC_LAYOUT mcLayout;

#ifdef MASA_AND_OBJECTS
    struct EncMasaIsmConfig
    {
        int16_t numObjects;
        const char *metadataFiles[IVAS_MAX_NUM_OBJECTS];
        IVAS_ENC_MASA_VARIANT masaVariant;
    } masa_ism;
#endif

#ifdef SBA_AND_OBJECTS
    struct EncSbaIsmConfig
@@ -464,7 +462,6 @@ int main(
            break;
#endif

#ifdef MASA_AND_OBJECTS
        case IVAS_ENC_INPUT_MASA_ISM:
            if ( ( error = IVAS_ENC_ConfigureForMASAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.masa_ism.numObjects, arg.inputFormatConfig.masa_ism.masaVariant ) ) != IVAS_ERR_OK )
            {
@@ -472,7 +469,6 @@ int main(
                exit( -1 );
            }
            break;
#endif

        default:
            fprintf( stderr, "\nInvalid input type\n\n" );
@@ -558,7 +554,6 @@ int main(
        }
    }

#ifdef MASA_AND_OBJECTS
    const int16_t numIsmInputs = ( arg.inputFormat == IVAS_ENC_INPUT_ISM || arg.inputFormat == IVAS_ENC_INPUT_MASA_ISM
#ifdef SBA_AND_OBJECTS
                                   || arg.inputFormat == IVAS_ENC_INPUT_SBA_ISM
@@ -566,9 +561,6 @@ int main(
                                   )
                                     ? arg.inputFormatConfig.ism.numObjects
                                     : 0;
#else
    const int16_t numIsmInputs = arg.inputFormat == IVAS_ENC_INPUT_ISM ? arg.inputFormatConfig.ism.numObjects : 0;
#endif

    for ( i = 0; i < numIsmInputs; ++i )
    {
@@ -1547,7 +1539,6 @@ static bool parseCmdlIVAS_enc(
                return false;
            }
        }
#ifdef MASA_AND_OBJECTS
        else if ( strcmp( to_upper( argv[i] ), "-ISM_MASA" ) == 0 )
        {
            arg->inputFormat = IVAS_ENC_INPUT_MASA_ISM;
@@ -1640,7 +1631,6 @@ static bool parseCmdlIVAS_enc(
                usage_enc();
            }
        }
#endif

#ifdef SBA_AND_OBJECTS
        else if ( strcmp( to_upper( argv[i] ), "-ISM_SBA" ) == 0 )
@@ -1943,13 +1933,11 @@ static void usage_enc( void )
    fprintf( stdout, "                      and Order specifies the SBA order (1 to 3) \n" );
    fprintf( stdout, "                      and IsmFiles specify input files containing ISM metadata, one file per object \n" );
#endif
#ifdef MASA_AND_OBJECTS
    fprintf( stdout, "-ism_masa IsmCh MasaCh IsmFiles MasaFile : MASA and ISM combined format \n" );
    fprintf( stdout, "                      where IsmCh specifies the number of ISMs (1-4),\n" );
    fprintf( stdout, "                      MasaCh specifies the number of MASA input/transport channels (1-2), \n" );
    fprintf( stdout, "                      IsmFiles specify input files containing ISM metadata, one file per object, \n" );
    fprintf( stdout, "                      and MasaFile specifies input file containing parametric MASA metadata \n" );
#endif
    fprintf( stdout, "-mc InputConf       : Multi-channel format\n" );
    fprintf( stdout, "                      where InputConf specifies the channel configuration: 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4\n" );
    fprintf( stdout, "                      Loudspeaker positions are assumed to have azimuth and elevation as per \n" );
+0 −12
Original line number Diff line number Diff line
@@ -484,7 +484,6 @@ int16_t get_ivas_max_num_indices(
            return 1650;
        }
    }
#ifdef MASA_AND_OBJECTS
    else if ( ivas_format == MASA_ISM_FORMAT )
    {
        if ( ivas_total_brate <= IVAS_16k4 )
@@ -524,7 +523,6 @@ int16_t get_ivas_max_num_indices(
            return 1850;
        }
    }
#endif
    else if ( ivas_format == MC_FORMAT )
    {
        if ( ivas_total_brate <= IVAS_16k4 )
@@ -721,7 +719,6 @@ int16_t get_ivas_max_num_indices_metadata(
            return 1750;
        }
    }
#ifdef MASA_AND_OBJECTS
    else if ( ivas_format == MASA_ISM_FORMAT )
    {
        if ( ivas_total_brate <= IVAS_16k4 )
@@ -765,7 +762,6 @@ int16_t get_ivas_max_num_indices_metadata(
            return 1750 + 30;
        }
    }
#endif
    else if ( ivas_format == MC_FORMAT )
    {
        if ( ivas_total_brate <= IVAS_13k2 )
@@ -2568,7 +2564,6 @@ ivas_error preview_indices(
                {
                    if ( bit_stream[2] )
                    {
#if defined MASA_AND_OBJECTS || defined SBA_AND_OBJECTS
                        if ( bit_stream[3] )
                        {
#ifdef SBA_AND_OBJECTS
@@ -2577,13 +2572,8 @@ ivas_error preview_indices(
                        }
                        else
                        {
#ifdef MASA_AND_OBJECTS
                            st_ivas->ivas_format = MASA_ISM_FORMAT;
#endif
                        }
#else
                        /* placeholder for combined format signaling */
#endif
                    }
                }
                break;
@@ -2776,7 +2766,6 @@ ivas_error preview_indices(
            ivas_sba_config( total_brate, st_ivas->sba_analysis_order, -1, &( st_ivas->nchan_transport ), st_ivas->sba_planar, &( st_ivas->nSCE ), &( st_ivas->nCPE ), &( st_ivas->element_mode_init ) );
        }
#endif
#ifdef MASA_AND_OBJECTS
        else if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
        {
            /* read number of objects from the bitstream */
@@ -2789,7 +2778,6 @@ ivas_error preview_indices(
                st_ivas->ism_mode = ivas_omasa_ism_mode_select( total_brate, st_ivas->nchan_ism );
            }
        }
#endif
    }

    st_ivas->hDecoderConfig->ivas_total_brate = total_brate;
+0 −2
Original line number Diff line number Diff line
@@ -263,9 +263,7 @@ enum{
enum
{
    IND_IVAS_FORMAT,
#ifdef MASA_AND_OBJECTS
    IND_SMODE_OMASA,
#endif
    IND_SMODE,
    IND_SID_TYPE,
    IND_BWIDTH,
+0 −8
Original line number Diff line number Diff line
@@ -73,11 +73,7 @@ int32_t get_delay(
        {
            delay = IVAS_ENC_DELAY_NS;

#ifdef MASA_AND_OBJECTS
            if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT )
#else
            if ( ivas_format == MASA_FORMAT )
#endif
            {
                delay = 0; /* All delay is compensated in the decoder with MASA */
            }
@@ -122,11 +118,7 @@ int32_t get_delay(
            }
#endif

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